about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2025-01-02 00:47:43 +0000
committerMichael Goulet <michael@errs.io>2025-01-02 00:48:06 +0000
commit2a373d7dd38a4bc3b04402d7cf84bd167727d1c8 (patch)
treeb2aba57a95b8d33a1b8ee416477e8f07f2b6e605
parentf3646748cd9d3cf5a6834f299acd10af1fe99c1b (diff)
downloadrust-2a373d7dd38a4bc3b04402d7cf84bd167727d1c8.tar.gz
rust-2a373d7dd38a4bc3b04402d7cf84bd167727d1c8.zip
Make it clearer that the only infers we expect to see when processing outlives are regions
-rw-r--r--compiler/rustc_infer/src/infer/outlives/obligations.rs9
1 files changed, 8 insertions, 1 deletions
diff --git a/compiler/rustc_infer/src/infer/outlives/obligations.rs b/compiler/rustc_infer/src/infer/outlives/obligations.rs
index 3512b2a5657..0383c81f2af 100644
--- a/compiler/rustc_infer/src/infer/outlives/obligations.rs
+++ b/compiler/rustc_infer/src/infer/outlives/obligations.rs
@@ -363,6 +363,13 @@ where
             return;
         }
 
+        if alias_ty.has_non_region_infer() {
+            self.tcx
+                .dcx()
+                .span_delayed_bug(origin.span(), "an alias has infers during region solving");
+            return;
+        }
+
         // This case is thorny for inference. The fundamental problem is
         // that there are many cases where we have choice, and inference
         // doesn't like choice (the current region inference in
@@ -408,7 +415,7 @@ where
         let is_opaque = alias_ty.kind(self.tcx) == ty::Opaque;
         if approx_env_bounds.is_empty()
             && trait_bounds.is_empty()
-            && (alias_ty.has_infer() || is_opaque)
+            && (alias_ty.has_infer_regions() || is_opaque)
         {
             debug!("no declared bounds");
             let opt_variances = is_opaque.then(|| self.tcx.variances_of(alias_ty.def_id));