Skip to content

Commit 396e92a

Browse files
authored
Unrolled build for rust-lang#140009
Rollup merge of rust-lang#140009 - ShE3py:tls-abort, r=thomcc docs(LocalKey<T>): clarify that T's Drop shouldn't panic Clarify that should a TLS destructor panics, the process will abort. Also, an abort may be obfuscated as the process can be terminated with `SIGSEGV` or [`STATUS_STACK_BUFFER_OVERRUN`](https://devblogs.microsoft.com/oldnewthing/20190108-00/?p=100655) (i.e., `SIGABRT` is not guaranteed), so explicitly prints that the process was aborted. Context: https://users.rust-lang.org/t/status-stack-buffer-overrun-on-windows-without-any-usage-of-unsafe/128417 ``@rustbot`` label -T-compiler
2 parents c8f9423 + 17b7d63 commit 396e92a

File tree

5 files changed

+9
-5
lines changed

5 files changed

+9
-5
lines changed

library/std/src/rt.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ macro_rules! rtprintpanic {
4646
macro_rules! rtabort {
4747
($($t:tt)*) => {
4848
{
49-
rtprintpanic!("fatal runtime error: {}\n", format_args!($($t)*));
49+
rtprintpanic!("fatal runtime error: {}, aborting\n", format_args!($($t)*));
5050
crate::sys::abort_internal();
5151
}
5252
}

library/std/src/thread/local.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,16 @@ use crate::fmt;
2222
///
2323
/// Initialization is dynamically performed on the first call to a setter (e.g.
2424
/// [`with`]) within a thread, and values that implement [`Drop`] get
25-
/// destructed when a thread exits. Some caveats apply, which are explained below.
25+
/// destructed when a thread exits. Some platform-specific caveats apply, which
26+
/// are explained below.
27+
/// Note that, should the destructor panics, the whole process will be [aborted].
2628
///
2729
/// A `LocalKey`'s initializer cannot recursively depend on itself. Using a
2830
/// `LocalKey` in this way may cause panics, aborts or infinite recursion on
2931
/// the first call to `with`.
3032
///
33+
/// [aborted]: crate::process::abort
34+
///
3135
/// # Single-thread Synchronization
3236
///
3337
/// Though there is no potential race with other threads, it is still possible to

src/tools/miri/tests/fail/panic/tls_macro_const_drop_panic.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
thread $NAME panicked at tests/fail/panic/tls_macro_const_drop_panic.rs:LL:CC:
33
ow
4-
fatal runtime error: thread local panicked on drop
4+
fatal runtime error: thread local panicked on drop, aborting
55
error: abnormal termination: the program aborted execution
66

77
error: aborting due to 1 previous error

src/tools/miri/tests/fail/panic/tls_macro_drop_panic.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
thread $NAME panicked at tests/fail/panic/tls_macro_drop_panic.rs:LL:CC:
33
ow
4-
fatal runtime error: thread local panicked on drop
4+
fatal runtime error: thread local panicked on drop, aborting
55
error: abnormal termination: the program aborted execution
66

77
error: aborting due to 1 previous error

tests/ui/runtime/rt-explody-panic-payloads.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,6 @@ fn main() {
2727
// by QEMU in the stderr whenever a core dump happens. Remove it before the check.
2828
v.strip_suffix("qemu: uncaught target signal 6 (Aborted) - core dumped\n").unwrap_or(v)
2929
})
30-
.map(|v| { v.ends_with("fatal runtime error: drop of the panic payload panicked\n") })
30+
.map(|v| v.ends_with("fatal runtime error: drop of the panic payload panicked, aborting\n"))
3131
.unwrap_or(false));
3232
}

0 commit comments

Comments
 (0)