forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of rust-lang#2929 - RalfJung:tls-panic, r=RalfJung
add tests for panicky drop in thread_local destructor Adds a test for rust-lang#112285
- Loading branch information
Showing
4 changed files
with
54 additions
and
0 deletions.
There are no files selected for viewing
22 changes: 22 additions & 0 deletions
22
src/tools/miri/tests/fail/panic/thread_local_const_drop_panic.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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'|'<unnamed>'" -> "$$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(|_| ()); | ||
} |
6 changes: 6 additions & 0 deletions
6
src/tools/miri/tests/fail/panic/thread_local_const_drop_panic.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
|
20 changes: 20 additions & 0 deletions
20
src/tools/miri/tests/fail/panic/thread_local_drop_panic.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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'|'<unnamed>'" -> "$$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(|_| ()); | ||
} |
6 changes: 6 additions & 0 deletions
6
src/tools/miri/tests/fail/panic/thread_local_drop_panic.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
|