1
Fork 0

Don't check unsize goal in MIR validation when opaques remain

This commit is contained in:
Michael Goulet 2024-09-28 13:21:39 -04:00
parent e7c0d27507
commit c7730989de
3 changed files with 23 additions and 10 deletions

View file

@ -595,6 +595,17 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
&self,
pred: impl Upcast<TyCtxt<'tcx>, ty::Predicate<'tcx>>,
) -> bool {
let pred: ty::Predicate<'tcx> = pred.upcast(self.tcx);
// We sometimes have to use `defining_opaque_types` for predicates
// to succeed here and figuring out how exactly that should work
// is annoying. It is harmless enough to just not validate anything
// in that case. We still check this after analysis as all opaque
// types have been revealed at this point.
if pred.has_opaque_types() {
return true;
}
let infcx = self.tcx.infer_ctxt().build();
let ocx = ObligationCtxt::new(&infcx);
ocx.register_obligation(Obligation::new(