rust/library
Jonas Schievink 01ca8299d4
Rollup merge of #77264 - fusion-engineering-forks:skip-local-stdio, r=dtolnay
Only use LOCAL_{STDOUT,STDERR} when set_{print/panic} is used.

The thread local `LOCAL_STDOUT` and `LOCAL_STDERR` are only used by the `test` crate to capture output from tests when running them in the same process in differen threads. However, every program will check these variables on every print, even outside of testing.

This involves allocating a thread local key, and registering a thread local destructor. This can be somewhat expensive.

This change keeps a global flag (`LOCAL_STREAMS`) which will be set to `true` when either of these local streams is used. (So, effectively only in test and benchmark runs.) When this flag is off, these thread locals are not even looked at and therefore will not be initialized on the first output on every thread, which also means no thread local destructors will be registered.

---

Together with https://github.com/rust-lang/rust/pull/77154, this should make output a little bit more efficient.
2020-10-03 00:31:14 +02:00
..
alloc Rollup merge of #75377 - canova:map_debug_impl, r=dtolnay 2020-10-03 00:31:04 +02:00
backtrace@4083a90168
core Rollup merge of #76745 - workingjubilee:move-wrapping-tests, r=matklad 2020-10-03 00:31:08 +02:00
panic_abort Rollup merge of #76866 - est31:master, r=lcnr 2020-09-20 15:51:50 +02:00
panic_unwind library/{panic_,}unwind: Add definitions for sparc-unknow-linux-gnu 2020-09-28 00:39:57 +02:00
proc_macro Add a feature gate for basic function pointer use in const fn 2020-09-27 10:46:41 -07:00
profiler_builtins Fix warning whe building profiler_builtins crate 2020-09-04 15:10:29 +02:00
rtstartup
rustc-std-workspace-alloc
rustc-std-workspace-core
rustc-std-workspace-std
std Rollup merge of #77264 - fusion-engineering-forks:skip-local-stdio, r=dtolnay 2020-10-03 00:31:14 +02:00
stdarch@b422b0180f fix redundant delarations of const_fn_transmute 2020-09-27 15:13:32 +08:00
term
test Rollup merge of #77389 - jyn514:THE-PAPERCLIP-COMETH, r=Mark-Simulacrum 2020-10-02 08:25:24 +09:00
unwind library/{panic_,}unwind: Add definitions for sparc-unknow-linux-gnu 2020-09-28 00:39:57 +02:00