1
Fork 0

pacify the parallel compiler

This commit is contained in:
Mazdak Farrokhzad 2020-01-17 14:42:27 +01:00
parent e233331a51
commit 154040097d
2 changed files with 5 additions and 5 deletions

View file

@ -435,11 +435,11 @@ pub unsafe fn handle_deadlock() {
let rustc_span_globals = let rustc_span_globals =
rustc_span::GLOBALS.with(|rustc_span_globals| rustc_span_globals as *const _); rustc_span::GLOBALS.with(|rustc_span_globals| rustc_span_globals as *const _);
let rustc_span_globals = &*rustc_span_globals; let rustc_span_globals = &*rustc_span_globals;
let syntax_globals = syntax::GLOBALS.with(|syntax_globals| syntax_globals as *const _); let syntax_globals = syntax::attr::GLOBALS.with(|syntax_globals| syntax_globals as *const _);
let syntax_globals = &*syntax_globals; let syntax_globals = &*syntax_globals;
thread::spawn(move || { thread::spawn(move || {
tls::GCX_PTR.set(gcx_ptr, || { tls::GCX_PTR.set(gcx_ptr, || {
syntax::GLOBALS.set(syntax_globals, || { syntax::attr::GLOBALS.set(syntax_globals, || {
rustc_span::GLOBALS rustc_span::GLOBALS
.set(rustc_span_globals, || tls::with_global(|tcx| deadlock(tcx, &registry))) .set(rustc_span_globals, || tls::with_global(|tcx| deadlock(tcx, &registry)))
}); });

View file

@ -183,15 +183,15 @@ pub fn spawn_thread_pool<F: FnOnce() -> R + Send, R: Send>(
let with_pool = move |pool: &ThreadPool| pool.install(move || f()); let with_pool = move |pool: &ThreadPool| pool.install(move || f());
syntax::with_globals(edition, || { syntax::attr::with_globals(edition, || {
syntax::GLOBALS.with(|syntax_globals| { syntax::attr::GLOBALS.with(|syntax_globals| {
rustc_span::GLOBALS.with(|rustc_span_globals| { rustc_span::GLOBALS.with(|rustc_span_globals| {
// The main handler runs for each Rayon worker thread and sets up // The main handler runs for each Rayon worker thread and sets up
// the thread local rustc uses. syntax_globals and rustc_span_globals are // the thread local rustc uses. syntax_globals and rustc_span_globals are
// captured and set on the new threads. ty::tls::with_thread_locals sets up // captured and set on the new threads. ty::tls::with_thread_locals sets up
// thread local callbacks from libsyntax // thread local callbacks from libsyntax
let main_handler = move |thread: ThreadBuilder| { let main_handler = move |thread: ThreadBuilder| {
syntax::GLOBALS.set(syntax_globals, || { syntax::attr::GLOBALS.set(syntax_globals, || {
rustc_span::GLOBALS.set(rustc_span_globals, || { rustc_span::GLOBALS.set(rustc_span_globals, || {
if let Some(stderr) = stderr { if let Some(stderr) = stderr {
io::set_panic(Some(box Sink(stderr.clone()))); io::set_panic(Some(box Sink(stderr.clone())));