about summary refs log tree commit diff
path: root/compiler/rustc_infer
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2025-07-13 21:01:25 +0000
committerMichael Goulet <michael@errs.io>2025-07-15 16:02:26 +0000
commit512cf3ae88b26f50a92ebfcb69c24ca39acd72e6 (patch)
treef8195454815901d9922dc128e68c37abc30cb549 /compiler/rustc_infer
parente3f643c70670a3e1567b0816502ab247565305f8 (diff)
downloadrust-512cf3ae88b26f50a92ebfcb69c24ca39acd72e6.tar.gz
rust-512cf3ae88b26f50a92ebfcb69c24ca39acd72e6.zip
Gate things properly
Diffstat (limited to 'compiler/rustc_infer')
-rw-r--r--compiler/rustc_infer/src/infer/outlives/mod.rs14
-rw-r--r--compiler/rustc_infer/src/infer/outlives/obligations.rs7
2 files changed, 12 insertions, 9 deletions
diff --git a/compiler/rustc_infer/src/infer/outlives/mod.rs b/compiler/rustc_infer/src/infer/outlives/mod.rs
index db668032f1f..19911bfbd48 100644
--- a/compiler/rustc_infer/src/infer/outlives/mod.rs
+++ b/compiler/rustc_infer/src/infer/outlives/mod.rs
@@ -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());
 
diff --git a/compiler/rustc_infer/src/infer/outlives/obligations.rs b/compiler/rustc_infer/src/infer/outlives/obligations.rs
index 2066cdd717e..1ca59c8d130 100644
--- a/compiler/rustc_infer/src/infer/outlives/obligations.rs
+++ b/compiler/rustc_infer/src/infer/outlives/obligations.rs
@@ -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;
                 }