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.
Rollup merge of rust-lang#94236 - reez12g:add_track_caller_87707, r=y…
…aahc Add #[track_caller] to track callers when initializing poisoned Once This PR is for this Issue. rust-lang#87707 With this fix, we expect to be able to track the caller when poisoned Once is initialized.
- Loading branch information
Showing
3 changed files
with
20 additions
and
0 deletions.
There are no files selected for viewing
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
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,15 @@ | ||
// test for #87707 | ||
// edition:2018 | ||
// run-fail | ||
// check-run-results | ||
|
||
use std::sync::Once; | ||
use std::panic; | ||
|
||
fn main() { | ||
let o = Once::new(); | ||
let _ = panic::catch_unwind(|| { | ||
o.call_once(|| panic!("Here Once instance is poisoned.")); | ||
}); | ||
o.call_once(|| {}); | ||
} |
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,3 @@ | ||
thread 'main' panicked at 'Here Once instance is poisoned.', $DIR/issue-87707.rs:12:24 | ||
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace | ||
thread 'main' panicked at 'Once instance has previously been poisoned', $DIR/issue-87707.rs:14:7 |