1
Fork 0

Gracefully handle non-WF alias in assemble_alias_bound_candidates_recur

This commit is contained in:
Michael Goulet 2024-02-10 23:49:16 +00:00
parent 6cc4843512
commit 5461fd4250
3 changed files with 42 additions and 2 deletions

View file

@ -15,7 +15,7 @@ use rustc_middle::ty::fast_reject::{SimplifiedType, TreatParams};
use rustc_middle::ty::{self, Ty, TyCtxt};
use rustc_middle::ty::{fast_reject, TypeFoldable};
use rustc_middle::ty::{ToPredicate, TypeVisitableExt};
use rustc_span::ErrorGuaranteed;
use rustc_span::{ErrorGuaranteed, DUMMY_SP};
use std::fmt::Debug;
pub(super) mod structural_traits;
@ -612,7 +612,11 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
ty::Alias(kind @ (ty::Projection | ty::Opaque), alias_ty) => (kind, alias_ty),
ty::Alias(ty::Inherent | ty::Weak, _) => {
unreachable!("Weak and Inherent aliases should have been normalized away already")
self.tcx().sess.dcx().span_delayed_bug(
DUMMY_SP,
format!("could not normalize {self_ty}, it is not WF"),
);
return;
}
};