X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=compiler%2Frustc_interface%2Fsrc%2Futil.rs;h=700710c82c9e08d48ff4a86fe2f3f19e4b17e291;hb=9a4212113592e83fb68ef9f347436d0d13517c1d;hp=f74cadfebacba748f4b38976884f0119cb1db976;hpb=783b56ba68c5737d9593c6e9bb964b44b6889ddc;p=rust.git diff --git a/compiler/rustc_interface/src/util.rs b/compiler/rustc_interface/src/util.rs index f74cadfebac..700710c82c9 100644 --- a/compiler/rustc_interface/src/util.rs +++ b/compiler/rustc_interface/src/util.rs @@ -27,7 +27,6 @@ use smallvec::SmallVec; use std::env; use std::env::consts::{DLL_PREFIX, DLL_SUFFIX}; -use std::io; use std::lazy::SyncOnceCell; use std::mem; use std::ops::DerefMut; @@ -35,7 +34,6 @@ use std::panic; use std::path::{Path, PathBuf}; use std::sync::atomic::{AtomicBool, Ordering}; -use std::sync::{Arc, Mutex}; use std::thread; use tracing::info; @@ -128,10 +126,9 @@ fn scoped_thread R + Send, R: Send>(cfg: thread::Builder, f: F) - } #[cfg(not(parallel_compiler))] -pub fn setup_callbacks_and_run_in_thread_pool_with_globals R + Send, R: Send>( +pub fn run_in_thread_pool_with_globals R + Send, R: Send>( edition: Edition, _threads: usize, - stderr: &Option>>>, f: F, ) -> R { let mut cfg = thread::Builder::new().name("rustc".to_string()); @@ -140,14 +137,7 @@ pub fn setup_callbacks_and_run_in_thread_pool_with_globals R + Se cfg = cfg.stack_size(size); } - crate::callbacks::setup_callbacks(); - - let main_handler = move || { - rustc_span::create_session_globals_then(edition, || { - io::set_output_capture(stderr.clone()); - f() - }) - }; + let main_handler = move || rustc_span::create_session_globals_then(edition, f); scoped_thread(cfg, main_handler) } @@ -176,14 +166,11 @@ unsafe fn handle_deadlock() { } #[cfg(parallel_compiler)] -pub fn setup_callbacks_and_run_in_thread_pool_with_globals R + Send, R: Send>( +pub fn run_in_thread_pool_with_globals R + Send, R: Send>( edition: Edition, threads: usize, - stderr: &Option>>>, f: F, ) -> R { - crate::callbacks::setup_callbacks(); - let mut config = rayon::ThreadPoolBuilder::new() .thread_name(|_| "rustc".to_string()) .acquire_thread_handler(jobserver::acquire_thread) @@ -203,10 +190,7 @@ pub fn setup_callbacks_and_run_in_thread_pool_with_globals R + Se // the thread local rustc uses. `session_globals` is captured and set // on the new threads. let main_handler = move |thread: rayon::ThreadBuilder| { - rustc_span::set_session_globals_then(session_globals, || { - io::set_output_capture(stderr.clone()); - thread.run() - }) + rustc_span::set_session_globals_then(session_globals, || thread.run()) }; config.build_scoped(main_handler, with_pool).unwrap() @@ -343,6 +327,7 @@ fn current_dll_path() -> Option { #[cfg(windows)] fn current_dll_path() -> Option { use std::ffi::OsString; + use std::io; use std::os::windows::prelude::*; use std::ptr;