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 <ojeda@kernel.org>
This commit is contained in:
Miguel Ojeda 2021-10-14 20:47:14 +02:00
parent 8a13871b69
commit 614c2e404a
4 changed files with 16 additions and 3 deletions

View File

@ -69,6 +69,8 @@
any(not(feature = "miri-test-libstd"), test, doctest), any(not(feature = "miri-test-libstd"), test, doctest),
no_global_oom_handling, no_global_oom_handling,
not(no_global_oom_handling), not(no_global_oom_handling),
not(no_rc),
not(no_sync),
target_has_atomic = "ptr" target_has_atomic = "ptr"
))] ))]
#![no_std] #![no_std]
@ -223,16 +225,17 @@ mod boxed {
} }
pub mod borrow; pub mod borrow;
pub mod collections; pub mod collections;
#[cfg(not(no_global_oom_handling))] #[cfg(all(not(no_rc), not(no_sync), not(no_global_oom_handling)))]
pub mod ffi; pub mod ffi;
pub mod fmt; pub mod fmt;
#[cfg(not(no_rc))]
pub mod rc; pub mod rc;
pub mod slice; pub mod slice;
pub mod str; pub mod str;
pub mod string; pub mod string;
#[cfg(target_has_atomic = "ptr")] #[cfg(all(not(no_rc), not(no_sync), target_has_atomic = "ptr"))]
pub mod sync; pub mod sync;
#[cfg(all(not(no_global_oom_handling), target_has_atomic = "ptr"))] #[cfg(all(not(no_global_oom_handling), not(no_rc), not(no_sync), target_has_atomic = "ptr"))]
pub mod task; pub mod task;
#[cfg(test)] #[cfg(test)]
mod tests; mod tests;

View File

@ -197,6 +197,8 @@ const EXTRA_CHECK_CFGS: &[(Option<Mode>, &'static str, Option<&[&'static str]>)]
(Some(Mode::Std), "stdarch_intel_sde", None), (Some(Mode::Std), "stdarch_intel_sde", None),
(Some(Mode::Std), "no_fp_fmt_parse", None), (Some(Mode::Std), "no_fp_fmt_parse", None),
(Some(Mode::Std), "no_global_oom_handling", None), (Some(Mode::Std), "no_global_oom_handling", None),
(Some(Mode::Std), "no_rc", None),
(Some(Mode::Std), "no_sync", None),
(Some(Mode::Std), "freebsd12", None), (Some(Mode::Std), "freebsd12", None),
(Some(Mode::Std), "backtrace_in_libstd", None), (Some(Mode::Std), "backtrace_in_libstd", None),
/* Extra values not defined in the built-in targets yet, but used in std */ /* Extra values not defined in the built-in targets yet, but used in std */

View File

@ -0,0 +1,4 @@
include ../tools.mk
all:
$(RUSTC) --edition=2021 -Dwarnings --crate-type=rlib ../../../../library/alloc/src/lib.rs --cfg no_rc

View File

@ -0,0 +1,4 @@
include ../tools.mk
all:
$(RUSTC) --edition=2021 -Dwarnings --crate-type=rlib ../../../../library/alloc/src/lib.rs --cfg no_sync