@@ -516,6 +516,7 @@ mod tests {
516
516
mpsc:: channel,
517
517
Mutex ,
518
518
} ,
519
+ thread,
519
520
} ;
520
521
521
522
#[ test]
@@ -552,26 +553,8 @@ mod tests {
552
553
}
553
554
}
554
555
555
- // miri doesn't support threads
556
- #[ cfg( not( miri) ) ]
557
556
fn spawn_and_wait < R : Send + ' static > ( f : impl FnOnce ( ) -> R + Send + ' static ) -> R {
558
- crate :: thread:: spawn ( f) . join ( ) . unwrap ( )
559
- }
560
-
561
- #[ cfg( not( miri) ) ]
562
- fn spawn ( f : impl FnOnce ( ) + Send + ' static ) {
563
- let _ = crate :: thread:: spawn ( f) ;
564
- }
565
-
566
- // "stub threads" for Miri
567
- #[ cfg( miri) ]
568
- fn spawn_and_wait < R : Send + ' static > ( f : impl FnOnce ( ) -> R + Send + ' static ) -> R {
569
- f ( ( ) )
570
- }
571
-
572
- #[ cfg( miri) ]
573
- fn spawn ( f : impl FnOnce ( ) + Send + ' static ) {
574
- f ( ( ) )
557
+ thread:: spawn ( f) . join ( ) . unwrap ( )
575
558
}
576
559
577
560
#[ test]
@@ -734,7 +717,6 @@ mod tests {
734
717
}
735
718
736
719
#[ test]
737
- #[ cfg_attr( miri, ignore) ] // leaks memory
738
720
fn static_sync_lazy ( ) {
739
721
static XS : SyncLazy < Vec < i32 > > = SyncLazy :: new ( || {
740
722
let mut xs = Vec :: new ( ) ;
@@ -752,7 +734,6 @@ mod tests {
752
734
}
753
735
754
736
#[ test]
755
- #[ cfg_attr( miri, ignore) ] // leaks memory
756
737
fn static_sync_lazy_via_fn ( ) {
757
738
fn xs ( ) -> & ' static Vec < i32 > {
758
739
static XS : SyncOnceCell < Vec < i32 > > = SyncOnceCell :: new ( ) ;
@@ -811,7 +792,6 @@ mod tests {
811
792
}
812
793
813
794
#[ test]
814
- #[ cfg_attr( miri, ignore) ] // deadlocks without real threads
815
795
fn sync_once_cell_does_not_leak_partially_constructed_boxes ( ) {
816
796
static ONCE_CELL : SyncOnceCell < String > = SyncOnceCell :: new ( ) ;
817
797
@@ -823,7 +803,7 @@ mod tests {
823
803
824
804
for _ in 0 ..n_readers {
825
805
let tx = tx. clone ( ) ;
826
- spawn ( move || {
806
+ thread :: spawn ( move || {
827
807
loop {
828
808
if let Some ( msg) = ONCE_CELL . get ( ) {
829
809
tx. send ( msg) . unwrap ( ) ;
@@ -835,7 +815,7 @@ mod tests {
835
815
} ) ;
836
816
}
837
817
for _ in 0 ..n_writers {
838
- spawn ( move || {
818
+ thread :: spawn ( move || {
839
819
let _ = ONCE_CELL . set ( MSG . to_owned ( ) ) ;
840
820
} ) ;
841
821
}
0 commit comments