From b2b5fa825dff427f87c577e605eaa5d382364909 Mon Sep 17 00:00:00 2001 From: Oli Scherer Date: Mon, 25 Mar 2024 10:34:03 +0000 Subject: [PATCH] Eagerly check for accidentally registered region constraints instead of waiting until borrowck is done --- compiler/rustc_borrowck/src/type_check/canonical.rs | 6 ++++++ 1 file changed, 6 insertions(+) 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);