about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-10-25 23:24:36 +0000
committerbors <bors@rust-lang.org>2022-10-25 23:24:36 +0000
commit6365e5ad9fa9e2ec867a67aeeae414e7c62d8354 (patch)
tree62cc39a39b8a320a5cc31e9d31b5216d21b932f0
parentbed4ad65bf7a1cef39e3d66b3670189581b3b073 (diff)
parent1727c00f1a810cae447e12bb564110527450219c (diff)
downloadrust-6365e5ad9fa9e2ec867a67aeeae414e7c62d8354.tar.gz
rust-6365e5ad9fa9e2ec867a67aeeae414e7c62d8354.zip
Auto merge of #102903 - compiler-errors:region-var-leak, r=jackh726
Assert if inference vars are leaking from `InferCtxt::fully_resolve`

`InferCtxt::fully_resolve` shouldn't return unresolved inference vars without us at least being aware of it, so make it an assertion now. This should only happen in cases where we used to be returning `ReEmpty`...

cc `@jackh726`
-rw-r--r--compiler/rustc_infer/src/infer/mod.rs7
1 files changed, 6 insertions, 1 deletions
diff --git a/compiler/rustc_infer/src/infer/mod.rs b/compiler/rustc_infer/src/infer/mod.rs
index 2732c92ecd3..7e2ea6c0e26 100644
--- a/compiler/rustc_infer/src/infer/mod.rs
+++ b/compiler/rustc_infer/src/infer/mod.rs
@@ -1469,7 +1469,12 @@ impl<'tcx> InferCtxt<'tcx> {
          * except during the writeback phase.
          */
 
-        resolve::fully_resolve(self, value)
+        let value = resolve::fully_resolve(self, value);
+        assert!(
+            value.as_ref().map_or(true, |value| !value.needs_infer()),
+            "`{value:?}` is not fully resolved"
+        );
+        value
     }
 
     pub fn replace_bound_vars_with_fresh_vars<T>(