From bec24a25cd61c5d252701b9119e4fe887b274937 Mon Sep 17 00:00:00 2001 From: bjorn3 <17426603+bjorn3@users.noreply.github.com> Date: Sun, 26 Nov 2023 20:32:48 +0000 Subject: [PATCH] Don't mutably borrow GlobalCtxt in QueryResult::enter This allows re-entrant entering of the GlobalCtxt --- compiler/rustc_interface/src/queries.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/rustc_interface/src/queries.rs b/compiler/rustc_interface/src/queries.rs index b6837ec764f..ff8cf790ef8 100644 --- a/compiler/rustc_interface/src/queries.rs +++ b/compiler/rustc_interface/src/queries.rs @@ -62,7 +62,7 @@ impl<'a, T> std::ops::DerefMut for QueryResult<'a, T> { impl<'a, 'tcx> QueryResult<'a, &'tcx GlobalCtxt<'tcx>> { pub fn enter(&mut self, f: impl FnOnce(TyCtxt<'tcx>) -> T) -> T { - (*self.0).get_mut().enter(f) + (*self.0).borrow().enter(f) } }