Skip to content

Commit 0a1de1d

Browse files
committed
Add cfg(no_io_statics) to core
Allows disabling the use of a static `AtomicPtr` as an implementation detail of `core::io`, regardless of the platform.
1 parent 31f3532 commit 0a1de1d

2 files changed

Lines changed: 11 additions & 2 deletions

File tree

library/core/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,5 +40,8 @@ check-cfg = [
4040
'cfg(target_has_reliable_f128)',
4141
'cfg(target_has_reliable_f128_math)',
4242
'cfg(llvm_enzyme)',
43+
# Prevents use of a static variable for providing platform specific RawOsError
44+
# functionality
45+
'cfg(no_io_statics)',
4346

4447
]

library/core/src/io/error.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,14 @@
1717
)]
1818
mod repr;
1919

20-
#[cfg_attr(target_has_atomic_load_store = "ptr", path = "error/os_functions_atomic.rs")]
21-
#[cfg_attr(not(target_has_atomic_load_store = "ptr"), path = "error/os_functions.rs")]
20+
#[cfg_attr(
21+
all(target_has_atomic_load_store = "ptr", not(no_io_statics)),
22+
path = "error/os_functions_atomic.rs"
23+
)]
24+
#[cfg_attr(
25+
not(all(target_has_atomic_load_store = "ptr", not(no_io_statics))),
26+
path = "error/os_functions.rs"
27+
)]
2228
mod os_functions;
2329

2430
use self::os_functions::{decode_error_kind, format_os_error, is_interrupted, set_functions};

0 commit comments

Comments
 (0)