Skip to content

Commit 614c2e4

Browse files
committed
alloc: add unstable cfg features no_rc and no_sync
In Rust for Linux we are using these to make `alloc` a bit more modular. A `run-make-fulldeps` test is added for each of them, so that enabling each of them independently is kept in a compilable state. Signed-off-by: Miguel Ojeda <[email protected]>
1 parent 8a13871 commit 614c2e4

File tree

4 files changed

+16
-3
lines changed

4 files changed

+16
-3
lines changed

library/alloc/src/lib.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@
6969
any(not(feature = "miri-test-libstd"), test, doctest),
7070
no_global_oom_handling,
7171
not(no_global_oom_handling),
72+
not(no_rc),
73+
not(no_sync),
7274
target_has_atomic = "ptr"
7375
))]
7476
#![no_std]
@@ -223,16 +225,17 @@ mod boxed {
223225
}
224226
pub mod borrow;
225227
pub mod collections;
226-
#[cfg(not(no_global_oom_handling))]
228+
#[cfg(all(not(no_rc), not(no_sync), not(no_global_oom_handling)))]
227229
pub mod ffi;
228230
pub mod fmt;
231+
#[cfg(not(no_rc))]
229232
pub mod rc;
230233
pub mod slice;
231234
pub mod str;
232235
pub mod string;
233-
#[cfg(target_has_atomic = "ptr")]
236+
#[cfg(all(not(no_rc), not(no_sync), target_has_atomic = "ptr"))]
234237
pub mod sync;
235-
#[cfg(all(not(no_global_oom_handling), target_has_atomic = "ptr"))]
238+
#[cfg(all(not(no_global_oom_handling), not(no_rc), not(no_sync), target_has_atomic = "ptr"))]
236239
pub mod task;
237240
#[cfg(test)]
238241
mod tests;

src/bootstrap/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,8 @@ const EXTRA_CHECK_CFGS: &[(Option<Mode>, &'static str, Option<&[&'static str]>)]
197197
(Some(Mode::Std), "stdarch_intel_sde", None),
198198
(Some(Mode::Std), "no_fp_fmt_parse", None),
199199
(Some(Mode::Std), "no_global_oom_handling", None),
200+
(Some(Mode::Std), "no_rc", None),
201+
(Some(Mode::Std), "no_sync", None),
200202
(Some(Mode::Std), "freebsd12", None),
201203
(Some(Mode::Std), "backtrace_in_libstd", None),
202204
/* Extra values not defined in the built-in targets yet, but used in std */
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
include ../tools.mk
2+
3+
all:
4+
$(RUSTC) --edition=2021 -Dwarnings --crate-type=rlib ../../../../library/alloc/src/lib.rs --cfg no_rc
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
include ../tools.mk
2+
3+
all:
4+
$(RUSTC) --edition=2021 -Dwarnings --crate-type=rlib ../../../../library/alloc/src/lib.rs --cfg no_sync

0 commit comments

Comments
 (0)