319
319
#![ doc(
320
320
html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png" ,
321
321
html_favicon_url = "https://www.rust-lang.org/favicon.ico" ,
322
- html_root_url = "https://docs.rs/log/0.4.18 "
322
+ html_root_url = "https://docs.rs/log/0.4.19 "
323
323
) ]
324
324
#![ warn( missing_docs) ]
325
325
#![ deny( missing_debug_implementations, unconditional_recursion) ]
@@ -346,20 +346,20 @@ mod serde;
346
346
#[ cfg( feature = "kv_unstable" ) ]
347
347
pub mod kv;
348
348
349
- #[ cfg( has_atomics ) ]
349
+ #[ cfg( target_has_atomic = "ptr" ) ]
350
350
use std:: sync:: atomic:: { AtomicUsize , Ordering } ;
351
351
352
- #[ cfg( not( has_atomics ) ) ]
352
+ #[ cfg( not( target_has_atomic = "ptr" ) ) ]
353
353
use std:: cell:: Cell ;
354
- #[ cfg( not( has_atomics ) ) ]
354
+ #[ cfg( not( target_has_atomic = "ptr" ) ) ]
355
355
use std:: sync:: atomic:: Ordering ;
356
356
357
- #[ cfg( not( has_atomics ) ) ]
357
+ #[ cfg( not( target_has_atomic = "ptr" ) ) ]
358
358
struct AtomicUsize {
359
359
v : Cell < usize > ,
360
360
}
361
361
362
- #[ cfg( not( has_atomics ) ) ]
362
+ #[ cfg( not( target_has_atomic = "ptr" ) ) ]
363
363
impl AtomicUsize {
364
364
const fn new ( v : usize ) -> AtomicUsize {
365
365
AtomicUsize { v : Cell :: new ( v) }
@@ -373,7 +373,7 @@ impl AtomicUsize {
373
373
self . v . set ( val)
374
374
}
375
375
376
- #[ cfg( atomic_cas ) ]
376
+ #[ cfg( target_has_atomic = "ptr" ) ]
377
377
fn compare_exchange (
378
378
& self ,
379
379
current : usize ,
@@ -391,7 +391,7 @@ impl AtomicUsize {
391
391
392
392
// Any platform without atomics is unlikely to have multiple cores, so
393
393
// writing via Cell will not be a race condition.
394
- #[ cfg( not( has_atomics ) ) ]
394
+ #[ cfg( not( target_has_atomic = "ptr" ) ) ]
395
395
unsafe impl Sync for AtomicUsize { }
396
396
397
397
// The LOGGER static holds a pointer to the global logger. It is protected by
@@ -1219,6 +1219,7 @@ where
1219
1219
///
1220
1220
/// Note that `Trace` is the maximum level, because it provides the maximum amount of detail in the emitted logs.
1221
1221
#[ inline]
1222
+ #[ cfg( target_has_atomic = "ptr" ) ]
1222
1223
pub fn set_max_level ( level : LevelFilter ) {
1223
1224
MAX_LOG_LEVEL_FILTER . store ( level as usize , Ordering :: Relaxed ) ;
1224
1225
}
@@ -1287,7 +1288,7 @@ pub fn max_level() -> LevelFilter {
1287
1288
/// An error is returned if a logger has already been set.
1288
1289
///
1289
1290
/// [`set_logger`]: fn.set_logger.html
1290
- #[ cfg( all( feature = "std" , atomic_cas ) ) ]
1291
+ #[ cfg( all( feature = "std" , target_has_atomic = "ptr" ) ) ]
1291
1292
pub fn set_boxed_logger ( logger : Box < dyn Log > ) -> Result < ( ) , SetLoggerError > {
1292
1293
set_logger_inner ( || Box :: leak ( logger) )
1293
1294
}
@@ -1345,12 +1346,12 @@ pub fn set_boxed_logger(logger: Box<dyn Log>) -> Result<(), SetLoggerError> {
1345
1346
/// ```
1346
1347
///
1347
1348
/// [`set_logger_racy`]: fn.set_logger_racy.html
1348
- #[ cfg( atomic_cas ) ]
1349
+ #[ cfg( target_has_atomic = "ptr" ) ]
1349
1350
pub fn set_logger ( logger : & ' static dyn Log ) -> Result < ( ) , SetLoggerError > {
1350
1351
set_logger_inner ( || logger)
1351
1352
}
1352
1353
1353
- #[ cfg( atomic_cas ) ]
1354
+ #[ cfg( target_has_atomic = "ptr" ) ]
1354
1355
fn set_logger_inner < F > ( make_logger : F ) -> Result < ( ) , SetLoggerError >
1355
1356
where
1356
1357
F : FnOnce ( ) -> & ' static dyn Log ,
0 commit comments