]> git.lizzy.rs Git - rust.git/commit
std: Don't assume thread::current() works on panic
authorAlex Crichton <alex@alexcrichton.com>
Wed, 15 Apr 2015 19:27:05 +0000 (12:27 -0700)
committerAlex Crichton <alex@alexcrichton.com>
Mon, 27 Apr 2015 23:15:36 +0000 (16:15 -0700)
commitd98ab4faf869ff0430ad73260b13ef8e473ef212
tree22fa7775d0ea81021b825738da48498d02ea4f5d
parent0e154aaad6486fa8bf19b02bc3026ede0ceb91cf
std: Don't assume thread::current() works on panic

Inspecting the current thread's info may not always work due to the TLS value
having been destroyed (or is actively being destroyed). The code for printing
a panic message assumed, however, that it could acquire the thread's name
through this method.

Instead this commit propagates the `Option` outwards to allow the
`std::panicking` module to handle the case where the current thread isn't
present.

While it solves the immediate issue of #24313, there is still another underlying
issue of panicking destructors in thread locals will abort the process.

Closes #24313
src/libstd/panicking.rs
src/libstd/sys/common/thread_info.rs
src/libstd/sys/unix/stack_overflow.rs
src/libstd/thread/mod.rs
src/test/run-pass/issue-24313.rs [new file with mode: 0644]