@@ -249,14 +249,14 @@ mod unsync {
249249 }
250250}
251251
252- #[ cfg( feature = "sync" ) ]
252+ #[ cfg( any ( feature = "std" , feature = "critical-section" ) ) ]
253253mod sync {
254254 use std:: sync:: atomic:: { AtomicUsize , Ordering :: SeqCst } ;
255255
256- #[ cfg( not ( feature = "critical-section" ) ) ]
256+ #[ cfg( feature = "std" ) ]
257257 use std:: sync:: Barrier ;
258258
259- #[ cfg( feature = "critical-section" ) ]
259+ #[ cfg( not ( feature = "std" ) ) ]
260260 use core:: cell:: Cell ;
261261
262262 use crossbeam_utils:: thread:: scope;
@@ -360,7 +360,7 @@ mod sync {
360360 assert_eq ! ( cell. get( ) , Some ( & "hello" . to_string( ) ) ) ;
361361 }
362362
363- #[ cfg( not ( feature = "critical-section" ) ) ]
363+ #[ cfg( feature = "std" ) ]
364364 #[ test]
365365 fn wait ( ) {
366366 let cell: OnceCell < String > = OnceCell :: new ( ) ;
@@ -372,7 +372,7 @@ mod sync {
372372 . unwrap ( ) ;
373373 }
374374
375- #[ cfg( not ( feature = "critical-section" ) ) ]
375+ #[ cfg( feature = "std" ) ]
376376 #[ test]
377377 fn get_or_init_stress ( ) {
378378 let n_threads = if cfg ! ( miri) { 30 } else { 1_000 } ;
@@ -437,7 +437,7 @@ mod sync {
437437
438438 #[ test]
439439 #[ cfg_attr( miri, ignore) ] // miri doesn't support processes
440- #[ cfg( not ( feature = "critical-section" ) ) ]
440+ #[ cfg( feature = "std" ) ]
441441 fn reentrant_init ( ) {
442442 let examples_dir = {
443443 let mut exe = std:: env:: current_exe ( ) . unwrap ( ) ;
@@ -465,7 +465,7 @@ mod sync {
465465 }
466466 }
467467
468- #[ cfg( feature = "critical-section" ) ]
468+ #[ cfg( not ( feature = "std" ) ) ]
469469 #[ test]
470470 #[ should_panic( expected = "reentrant init" ) ]
471471 fn reentrant_init ( ) {
@@ -658,7 +658,7 @@ mod sync {
658658 }
659659 }
660660
661- #[ cfg( not ( feature = "critical-section" ) ) ]
661+ #[ cfg( feature = "std" ) ]
662662 #[ test]
663663 fn get_does_not_block ( ) {
664664 let cell = OnceCell :: new ( ) ;
@@ -692,7 +692,7 @@ mod sync {
692692
693693#[ cfg( feature = "race" ) ]
694694mod race {
695- #[ cfg( not ( feature = "critical-section" ) ) ]
695+ #[ cfg( feature = "std" ) ]
696696 use std:: sync:: Barrier ;
697697 use std:: {
698698 num:: NonZeroUsize ,
@@ -748,7 +748,7 @@ mod race {
748748 assert_eq ! ( cell. get( ) , Some ( val1) ) ;
749749 }
750750
751- #[ cfg( not ( feature = "critical-section" ) ) ]
751+ #[ cfg( feature = "std" ) ]
752752 #[ test]
753753 fn once_non_zero_usize_first_wins ( ) {
754754 let val1 = NonZeroUsize :: new ( 92 ) . unwrap ( ) ;
@@ -828,14 +828,14 @@ mod race {
828828
829829#[ cfg( all( feature = "race" , feature = "alloc" ) ) ]
830830mod race_once_box {
831- #[ cfg( not ( feature = "critical-section" ) ) ]
831+ #[ cfg( feature = "std" ) ]
832832 use std:: sync:: Barrier ;
833833 use std:: sync:: {
834834 atomic:: { AtomicUsize , Ordering :: SeqCst } ,
835835 Arc ,
836836 } ;
837837
838- #[ cfg( not ( feature = "critical-section" ) ) ]
838+ #[ cfg( feature = "std" ) ]
839839 use crossbeam_utils:: thread:: scope;
840840
841841 use once_cell:: race:: OnceBox ;
@@ -867,7 +867,7 @@ mod race_once_box {
867867 }
868868 }
869869
870- #[ cfg( not ( feature = "critical-section" ) ) ]
870+ #[ cfg( feature = "std" ) ]
871871 #[ test]
872872 fn once_box_smoke_test ( ) {
873873 let heap = Heap :: default ( ) ;
@@ -922,7 +922,7 @@ mod race_once_box {
922922 assert_eq ! ( heap. total( ) , 0 ) ;
923923 }
924924
925- #[ cfg( not ( feature = "critical-section" ) ) ]
925+ #[ cfg( feature = "std" ) ]
926926 #[ test]
927927 fn once_box_first_wins ( ) {
928928 let cell = OnceBox :: new ( ) ;
0 commit comments