Remove FromDyn::from and add check_dyn_thread_safe

This commit is contained in:
Daria Sukhonina
2026-03-17 14:46:12 +03:00
parent 15f42e2613
commit 3973d9f558
3 changed files with 50 additions and 41 deletions
+4 -5
View File
@@ -183,7 +183,6 @@ pub(crate) fn run_in_thread_pool_with_globals<
use std::process;
use rustc_data_structures::defer;
use rustc_data_structures::sync::FromDyn;
use rustc_middle::ty::tls;
use rustc_query_impl::break_query_cycles;
@@ -191,7 +190,7 @@ pub(crate) fn run_in_thread_pool_with_globals<
let registry = sync::Registry::new(std::num::NonZero::new(threads).unwrap());
if !sync::is_dyn_thread_safe() {
let Some(proof) = sync::check_dyn_thread_safe() else {
return run_in_thread_with_globals(
thread_stack_size,
edition,
@@ -204,9 +203,9 @@ pub(crate) fn run_in_thread_pool_with_globals<
f(current_gcx, jobserver_proxy)
},
);
}
};
let current_gcx = FromDyn::from(CurrentGcx::new());
let current_gcx = proof.derive(CurrentGcx::new());
let current_gcx2 = current_gcx.clone();
let proxy = Proxy::new();
@@ -278,7 +277,7 @@ pub(crate) fn run_in_thread_pool_with_globals<
// `Send` in the parallel compiler.
rustc_span::create_session_globals_then(edition, extra_symbols, Some(sm_inputs), || {
rustc_span::with_session_globals(|session_globals| {
let session_globals = FromDyn::from(session_globals);
let session_globals = proof.derive(session_globals);
builder
.build_scoped(
// Initialize each new worker thread when created.