diff --git a/src/tools/miri/tests/fail/panic/thread_local_const_drop_panic.rs b/src/tools/miri/tests/fail/panic/thread_local_const_drop_panic.rs new file mode 100644 index 00000000000..93ad42ea1cc --- /dev/null +++ b/src/tools/miri/tests/fail/panic/thread_local_const_drop_panic.rs @@ -0,0 +1,22 @@ +//@error-in-other-file: aborted execution +// Backtraces vary wildly between platforms, we have to normalize away almost the entire thing. +// Full backtraces avoid annoying empty line differences. +//@compile-flags: -Zmiri-backtrace=full +//@normalize-stderr-test: "'main'|''" -> "$$NAME" +//@normalize-stderr-test: ".*(note|-->|\|).*\n" -> "" + +pub struct NoisyDrop {} + +impl Drop for NoisyDrop { + fn drop(&mut self) { + panic!("ow"); + } +} + +thread_local! { + pub static NOISY: NoisyDrop = const { NoisyDrop {} }; +} + +fn main() { + NOISY.with(|_| ()); +} diff --git a/src/tools/miri/tests/fail/panic/thread_local_const_drop_panic.stderr b/src/tools/miri/tests/fail/panic/thread_local_const_drop_panic.stderr new file mode 100644 index 00000000000..47962e44adf --- /dev/null +++ b/src/tools/miri/tests/fail/panic/thread_local_const_drop_panic.stderr @@ -0,0 +1,6 @@ +thread $NAME panicked at 'ow', $DIR/thread_local_const_drop_panic.rs:LL:CC +fatal runtime error: thread local panicked on drop +error: abnormal termination: the program aborted execution + +error: aborting due to previous error + diff --git a/src/tools/miri/tests/fail/panic/thread_local_drop_panic.rs b/src/tools/miri/tests/fail/panic/thread_local_drop_panic.rs new file mode 100644 index 00000000000..107d70a3b3c --- /dev/null +++ b/src/tools/miri/tests/fail/panic/thread_local_drop_panic.rs @@ -0,0 +1,20 @@ +//@error-in-other-file: aborted execution +// Backtraces vary wildly between platforms, we have to normalize away almost the entire thing +//@normalize-stderr-test: "'main'|''" -> "$$NAME" +//@normalize-stderr-test: ".*(note|-->|\|).*\n" -> "" + +pub struct NoisyDrop {} + +impl Drop for NoisyDrop { + fn drop(&mut self) { + panic!("ow"); + } +} + +thread_local! { + pub static NOISY: NoisyDrop = NoisyDrop {}; +} + +fn main() { + NOISY.with(|_| ()); +} diff --git a/src/tools/miri/tests/fail/panic/thread_local_drop_panic.stderr b/src/tools/miri/tests/fail/panic/thread_local_drop_panic.stderr new file mode 100644 index 00000000000..2a56e2b9c87 --- /dev/null +++ b/src/tools/miri/tests/fail/panic/thread_local_drop_panic.stderr @@ -0,0 +1,6 @@ +thread $NAME panicked at 'ow', $DIR/thread_local_drop_panic.rs:LL:CC +fatal runtime error: thread local panicked on drop +error: abnormal termination: the program aborted execution + +error: aborting due to previous error +