Skip to content

Commit a5d4ddf

Browse files
authored
Rollup merge of rust-lang#94236 - reez12g:add_track_caller_87707, r=yaahc
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.
2 parents 3f376d3 + bbd9198 commit a5d4ddf

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

std/src/sync/once.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,7 @@ impl Once {
256256
///
257257
/// [poison]: struct.Mutex.html#poisoning
258258
#[stable(feature = "rust1", since = "1.0.0")]
259+
#[track_caller]
259260
pub fn call_once<F>(&self, f: F)
260261
where
261262
F: FnOnce(),
@@ -390,6 +391,7 @@ impl Once {
390391
// currently no way to take an `FnOnce` and call it via virtual dispatch
391392
// without some allocation overhead.
392393
#[cold]
394+
#[track_caller]
393395
fn call_inner(&self, ignore_poisoning: bool, init: &mut dyn FnMut(&OnceState)) {
394396
let mut state_and_queue = self.state_and_queue.load(Ordering::Acquire);
395397
loop {

0 commit comments

Comments
 (0)