diff --git a/compiler/rustc_interface/src/util.rs b/compiler/rustc_interface/src/util.rs index e84e8fffbe41a..4df8df7283d70 100644 --- a/compiler/rustc_interface/src/util.rs +++ b/compiler/rustc_interface/src/util.rs @@ -205,9 +205,8 @@ pub(crate) fn run_in_thread_pool_with_globals R + Send, }); } - let current_gcx = CurrentGcx::new(); - let current_gcx_ = FromDyn::from(current_gcx.clone()); - let current_gcx = FromDyn::from(current_gcx); + let current_gcx = FromDyn::from(CurrentGcx::new()); + let current_gcx2 = current_gcx.clone(); let mut builder = rayon::ThreadPoolBuilder::new() .thread_name(|_| "rustc".to_string()) @@ -220,7 +219,7 @@ pub(crate) fn run_in_thread_pool_with_globals R + Send, // Get a `GlobalCtxt` reference from `CurrentGcx` as we cannot rely on having a // `TyCtxt` TLS reference here. - let query_map = current_gcx_.access(|gcx| { + let query_map = current_gcx2.access(|gcx| { tls::enter_context(&tls::ImplicitCtxt::new(gcx), || { tls::with(|tcx| { QueryCtxt::new(tcx)