about summary refs log tree commit diff
path: root/library/std
diff options
context:
space:
mode:
authorreez12g <reez12g@gmail.com>2022-02-22 08:37:52 +0900
committerMark Rousskov <mark.simulacrum@gmail.com>2022-03-03 22:41:27 -0500
commitbca67fe02f010754b5522c2c6234375cffa66b81 (patch)
treebd94d4205ae556425b5d4f2cc7a9d0e122dcb94c /library/std
parent6d7684101a51f1c375ec84aef5d2fbdeb214bbc2 (diff)
downloadrust-bca67fe02f010754b5522c2c6234375cffa66b81.tar.gz
rust-bca67fe02f010754b5522c2c6234375cffa66b81.zip
Add #[track_caller] to track callers when initializing poisoned Once
Diffstat (limited to 'library/std')
-rw-r--r--library/std/src/sync/once.rs2
1 files changed, 2 insertions, 0 deletions
diff --git a/library/std/src/sync/once.rs b/library/std/src/sync/once.rs
index f76d0759561..511de863dc5 100644
--- a/library/std/src/sync/once.rs
+++ b/library/std/src/sync/once.rs
@@ -256,6 +256,7 @@ impl Once {
     ///
     /// [poison]: struct.Mutex.html#poisoning
     #[stable(feature = "rust1", since = "1.0.0")]
+    #[track_caller]
     pub fn call_once<F>(&self, f: F)
     where
         F: FnOnce(),
@@ -390,6 +391,7 @@ impl Once {
     // currently no way to take an `FnOnce` and call it via virtual dispatch
     // without some allocation overhead.
     #[cold]
+    #[track_caller]
     fn call_inner(&self, ignore_poisoning: bool, init: &mut dyn FnMut(&OnceState)) {
         let mut state_and_queue = self.state_and_queue.load(Ordering::Acquire);
         loop {