about summary refs log tree commit diff
diff options
context:
space:
mode:
authorOli Scherer <git-spam-no-reply9815368754983@oli-obk.de>2024-03-25 10:34:03 +0000
committerOli Scherer <git-spam-no-reply9815368754983@oli-obk.de>2024-04-08 15:00:26 +0000
commitb2b5fa825dff427f87c577e605eaa5d382364909 (patch)
tree6e7f79ebbd4e3711cddeaea30e29a9cd36f5d0c0
parent19bd91d128d921522287314925c027ea4aea1e45 (diff)
downloadrust-b2b5fa825dff427f87c577e605eaa5d382364909.tar.gz
rust-b2b5fa825dff427f87c577e605eaa5d382364909.zip
Eagerly check for accidentally registered region constraints instead of waiting until borrowck is done
-rw-r--r--compiler/rustc_borrowck/src/type_check/canonical.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/compiler/rustc_borrowck/src/type_check/canonical.rs b/compiler/rustc_borrowck/src/type_check/canonical.rs
index f28b786e4f7..a950f10787b 100644
--- a/compiler/rustc_borrowck/src/type_check/canonical.rs
+++ b/compiler/rustc_borrowck/src/type_check/canonical.rs
@@ -39,6 +39,12 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
 
         let TypeOpOutput { output, constraints, error_info } =
             op.fully_perform(self.infcx, locations.span(self.body))?;
+        if cfg!(debug_assertions) {
+            let data = self.infcx.take_and_reset_region_constraints();
+            if !data.is_empty() {
+                panic!("leftover region constraints: {data:#?}");
+            }
+        }
 
         debug!(?output, ?constraints);