about summary refs log tree commit diff
path: root/compiler/rustc_interface/src
diff options
context:
space:
mode:
authorMara Bos <m-ou.se@m-ou.se>2020-11-03 21:44:21 +0100
committerMara Bos <m-ou.se@m-ou.se>2020-11-10 21:58:09 +0100
commitf534b75f050f2daca87c15f6c8d04bf9dc5b68a6 (patch)
tree955d68e656130dbaf65cd0ac2f220c9911c2ed0a /compiler/rustc_interface/src
parentccbce1d3b2b9f74619d19c6d3377d20dd06e0050 (diff)
downloadrust-f534b75f050f2daca87c15f6c8d04bf9dc5b68a6.tar.gz
rust-f534b75f050f2daca87c15f6c8d04bf9dc5b68a6.zip
Use Vec<u8> for LOCAL_STD{OUT,ERR} instead of dyn Write.
It was only ever used with Vec<u8> anyway. This simplifies some things.

- It no longer needs to be flushed, because that's a no-op anyway for
  a Vec<u8>.

- Writing to a Vec<u8> never fails.

- No #[cfg(test)] code is needed anymore to use `realstd` instead of
  `std`, because Vec comes from alloc, not std (like Write).
Diffstat (limited to 'compiler/rustc_interface/src')
-rw-r--r--compiler/rustc_interface/src/util.rs8
1 files changed, 2 insertions, 6 deletions
diff --git a/compiler/rustc_interface/src/util.rs b/compiler/rustc_interface/src/util.rs
index d90fff3bae5..94a7a5ba793 100644
--- a/compiler/rustc_interface/src/util.rs
+++ b/compiler/rustc_interface/src/util.rs
@@ -148,9 +148,7 @@ pub fn setup_callbacks_and_run_in_thread_pool_with_globals<F: FnOnce() -> R + Se
 
     let main_handler = move || {
         rustc_span::with_session_globals(edition, || {
-            if let Some(stderr) = stderr {
-                io::set_panic(Some(stderr.clone()));
-            }
+            io::set_panic(stderr.clone());
             f()
         })
     };
@@ -188,9 +186,7 @@ pub fn setup_callbacks_and_run_in_thread_pool_with_globals<F: FnOnce() -> R + Se
             // on the new threads.
             let main_handler = move |thread: rayon::ThreadBuilder| {
                 rustc_span::SESSION_GLOBALS.set(session_globals, || {
-                    if let Some(stderr) = stderr {
-                        io::set_panic(Some(stderr.clone()));
-                    }
+                    io::set_panic(stderr.clone());
                     thread.run()
                 })
             };