@@ -391,6 +391,7 @@ impl Builder {
391391 /// handler.join().unwrap();
392392 /// ```
393393 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
394+ #[ cfg_attr( miri, track_caller) ] // even without panics, this helps for Miri backtraces
394395 pub fn spawn < F , T > ( self , f : F ) -> io:: Result < JoinHandle < T > >
395396 where
396397 F : FnOnce ( ) -> T ,
@@ -458,6 +459,7 @@ impl Builder {
458459 ///
459460 /// [`io::Result`]: crate::io::Result
460461 #[ stable( feature = "thread_spawn_unchecked" , since = "1.82.0" ) ]
462+ #[ cfg_attr( miri, track_caller) ] // even without panics, this helps for Miri backtraces
461463 pub unsafe fn spawn_unchecked < F , T > ( self , f : F ) -> io:: Result < JoinHandle < T > >
462464 where
463465 F : FnOnce ( ) -> T ,
@@ -467,6 +469,7 @@ impl Builder {
467469 Ok ( JoinHandle ( unsafe { self . spawn_unchecked_ ( f, None ) } ?) )
468470 }
469471
472+ #[ cfg_attr( miri, track_caller) ] // even without panics, this helps for Miri backtraces
470473 unsafe fn spawn_unchecked_ < ' scope , F , T > (
471474 self ,
472475 f : F ,
@@ -721,6 +724,7 @@ impl Builder {
721724/// [`join`]: JoinHandle::join
722725/// [`Err`]: crate::result::Result::Err
723726#[ stable( feature = "rust1" , since = "1.0.0" ) ]
727+ #[ cfg_attr( miri, track_caller) ] // even without panics, this helps for Miri backtraces
724728pub fn spawn < F , T > ( f : F ) -> JoinHandle < T >
725729where
726730 F : FnOnce ( ) -> T ,
0 commit comments