@@ -391,6 +391,7 @@ impl Builder {
391
391
/// handler.join().unwrap();
392
392
/// ```
393
393
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
394
+ #[ cfg_attr( miri, track_caller) ] // even without panics, this helps for Miri backtraces
394
395
pub fn spawn < F , T > ( self , f : F ) -> io:: Result < JoinHandle < T > >
395
396
where
396
397
F : FnOnce ( ) -> T ,
@@ -458,6 +459,7 @@ impl Builder {
458
459
///
459
460
/// [`io::Result`]: crate::io::Result
460
461
#[ stable( feature = "thread_spawn_unchecked" , since = "1.82.0" ) ]
462
+ #[ cfg_attr( miri, track_caller) ] // even without panics, this helps for Miri backtraces
461
463
pub unsafe fn spawn_unchecked < F , T > ( self , f : F ) -> io:: Result < JoinHandle < T > >
462
464
where
463
465
F : FnOnce ( ) -> T ,
@@ -467,6 +469,7 @@ impl Builder {
467
469
Ok ( JoinHandle ( unsafe { self . spawn_unchecked_ ( f, None ) } ?) )
468
470
}
469
471
472
+ #[ cfg_attr( miri, track_caller) ] // even without panics, this helps for Miri backtraces
470
473
unsafe fn spawn_unchecked_ < ' scope , F , T > (
471
474
self ,
472
475
f : F ,
@@ -721,6 +724,7 @@ impl Builder {
721
724
/// [`join`]: JoinHandle::join
722
725
/// [`Err`]: crate::result::Result::Err
723
726
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
727
+ #[ cfg_attr( miri, track_caller) ] // even without panics, this helps for Miri backtraces
724
728
pub fn spawn < F , T > ( f : F ) -> JoinHandle < T >
725
729
where
726
730
F : FnOnce ( ) -> T ,
0 commit comments