Gate things properly

This commit is contained in:
Michael Goulet
2025-07-13 21:01:25 +00:00
parent e3f643c706
commit 512cf3ae88
12 changed files with 121 additions and 14 deletions

View File

@@ -69,12 +69,14 @@ impl<'tcx> InferCtxt<'tcx> {
// Filter out any region-region outlives assumptions that are implied by
// coroutine well-formedness.
storage.data.constraints.retain(|(constraint, _)| match *constraint {
Constraint::RegSubReg(r1, r2) => !outlives_env
.higher_ranked_assumptions()
.contains(&ty::OutlivesPredicate(r2.into(), r1)),
_ => true,
});
if self.tcx.sess.opts.unstable_opts.higher_ranked_assumptions {
storage.data.constraints.retain(|(constraint, _)| match *constraint {
Constraint::RegSubReg(r1, r2) => !outlives_env
.higher_ranked_assumptions()
.contains(&ty::OutlivesPredicate(r2.into(), r1)),
_ => true,
});
}
let region_rels = &RegionRelations::new(self.tcx, outlives_env.free_region_map());

View File

@@ -235,9 +235,10 @@ impl<'tcx> InferCtxt<'tcx> {
let (sup_type, sub_region) =
(sup_type, sub_region).fold_with(&mut OpportunisticRegionResolver::new(self));
if outlives_env
.higher_ranked_assumptions()
.contains(&ty::OutlivesPredicate(sup_type.into(), sub_region))
if self.tcx.sess.opts.unstable_opts.higher_ranked_assumptions
&& outlives_env
.higher_ranked_assumptions()
.contains(&ty::OutlivesPredicate(sup_type.into(), sub_region))
{
continue;
}