@@ -344,20 +344,20 @@ mod serde;
344
344
#[ cfg( feature = "kv_unstable" ) ]
345
345
pub mod kv;
346
346
347
- #[ cfg( target_has_atomic = "ptr" ) ]
347
+ #[ cfg( has_atomics ) ]
348
348
use std:: sync:: atomic:: { AtomicUsize , Ordering } ;
349
349
350
- #[ cfg( not( target_has_atomic = "ptr" ) ) ]
350
+ #[ cfg( not( has_atomics ) ) ]
351
351
use std:: cell:: Cell ;
352
- #[ cfg( not( target_has_atomic = "ptr" ) ) ]
352
+ #[ cfg( not( has_atomics ) ) ]
353
353
use std:: sync:: atomic:: Ordering ;
354
354
355
- #[ cfg( not( target_has_atomic = "ptr" ) ) ]
355
+ #[ cfg( not( has_atomics ) ) ]
356
356
struct AtomicUsize {
357
357
v : Cell < usize > ,
358
358
}
359
359
360
- #[ cfg( not( target_has_atomic = "ptr" ) ) ]
360
+ #[ cfg( not( has_atomics ) ) ]
361
361
impl AtomicUsize {
362
362
const fn new ( v : usize ) -> AtomicUsize {
363
363
AtomicUsize { v : Cell :: new ( v) }
@@ -371,7 +371,7 @@ impl AtomicUsize {
371
371
self . v . set ( val)
372
372
}
373
373
374
- #[ cfg( target_has_atomic = "ptr" ) ]
374
+ #[ cfg( atomic_cas ) ]
375
375
fn compare_exchange (
376
376
& self ,
377
377
current : usize ,
@@ -389,7 +389,7 @@ impl AtomicUsize {
389
389
390
390
// Any platform without atomics is unlikely to have multiple cores, so
391
391
// writing via Cell will not be a race condition.
392
- #[ cfg( not( target_has_atomic = "ptr" ) ) ]
392
+ #[ cfg( not( has_atomics ) ) ]
393
393
unsafe impl Sync for AtomicUsize { }
394
394
395
395
// The LOGGER static holds a pointer to the global logger. It is protected by
@@ -1217,7 +1217,6 @@ where
1217
1217
///
1218
1218
/// Note that `Trace` is the maximum level, because it provides the maximum amount of detail in the emitted logs.
1219
1219
#[ inline]
1220
- #[ cfg( target_has_atomic = "ptr" ) ]
1221
1220
pub fn set_max_level ( level : LevelFilter ) {
1222
1221
MAX_LOG_LEVEL_FILTER . store ( level as usize , Ordering :: Relaxed ) ;
1223
1222
}
@@ -1286,7 +1285,7 @@ pub fn max_level() -> LevelFilter {
1286
1285
/// An error is returned if a logger has already been set.
1287
1286
///
1288
1287
/// [`set_logger`]: fn.set_logger.html
1289
- #[ cfg( all( feature = "std" , target_has_atomic = "ptr" ) ) ]
1288
+ #[ cfg( all( feature = "std" , atomic_cas ) ) ]
1290
1289
pub fn set_boxed_logger ( logger : Box < dyn Log > ) -> Result < ( ) , SetLoggerError > {
1291
1290
set_logger_inner ( || Box :: leak ( logger) )
1292
1291
}
@@ -1344,12 +1343,12 @@ pub fn set_boxed_logger(logger: Box<dyn Log>) -> Result<(), SetLoggerError> {
1344
1343
/// ```
1345
1344
///
1346
1345
/// [`set_logger_racy`]: fn.set_logger_racy.html
1347
- #[ cfg( target_has_atomic = "ptr" ) ]
1346
+ #[ cfg( atomic_cas ) ]
1348
1347
pub fn set_logger ( logger : & ' static dyn Log ) -> Result < ( ) , SetLoggerError > {
1349
1348
set_logger_inner ( || logger)
1350
1349
}
1351
1350
1352
- #[ cfg( target_has_atomic = "ptr" ) ]
1351
+ #[ cfg( atomic_cas ) ]
1353
1352
fn set_logger_inner < F > ( make_logger : F ) -> Result < ( ) , SetLoggerError >
1354
1353
where
1355
1354
F : FnOnce ( ) -> & ' static dyn Log ,
0 commit comments