diff options
| author | Ralf Jung <post@ralfj.de> | 2024-12-20 15:03:51 +0100 |
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2024-12-20 15:03:51 +0100 |
| commit | 8b2b6359f97ee9ac8fb1b5c35e86211222d02574 (patch) | |
| tree | ef7f4f6d98b6367cfb92df5c4c48e2fd53ece29c /library/std/src/thread | |
| parent | 5dfe648b45659db8dd0a673a806bba3df84aa3af (diff) | |
| download | rust-8b2b6359f97ee9ac8fb1b5c35e86211222d02574.tar.gz rust-8b2b6359f97ee9ac8fb1b5c35e86211222d02574.zip | |
mri: add track_caller to thread spawning methods for better backtraces
Diffstat (limited to 'library/std/src/thread')
| -rw-r--r-- | library/std/src/thread/mod.rs | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/library/std/src/thread/mod.rs b/library/std/src/thread/mod.rs index cfbf6548a38..85ee369ca2b 100644 --- a/library/std/src/thread/mod.rs +++ b/library/std/src/thread/mod.rs @@ -391,6 +391,7 @@ impl Builder { /// handler.join().unwrap(); /// ``` #[stable(feature = "rust1", since = "1.0.0")] + #[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces pub fn spawn<F, T>(self, f: F) -> io::Result<JoinHandle<T>> where F: FnOnce() -> T, @@ -458,6 +459,7 @@ impl Builder { /// /// [`io::Result`]: crate::io::Result #[stable(feature = "thread_spawn_unchecked", since = "1.82.0")] + #[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces pub unsafe fn spawn_unchecked<F, T>(self, f: F) -> io::Result<JoinHandle<T>> where F: FnOnce() -> T, @@ -467,6 +469,7 @@ impl Builder { Ok(JoinHandle(unsafe { self.spawn_unchecked_(f, None) }?)) } + #[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces unsafe fn spawn_unchecked_<'scope, F, T>( self, f: F, @@ -721,6 +724,7 @@ impl Builder { /// [`join`]: JoinHandle::join /// [`Err`]: crate::result::Result::Err #[stable(feature = "rust1", since = "1.0.0")] +#[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces pub fn spawn<F, T>(f: F) -> JoinHandle<T> where F: FnOnce() -> T, |
