diff options
| author | Dylan DPC <99973273+Dylan-DPC@users.noreply.github.com> | 2022-09-21 19:01:06 +0530 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-09-21 19:01:06 +0530 |
| commit | 5377c3112288a759d29f9b9e916fb45da35f51c3 (patch) | |
| tree | 22198e9830e269fce5989ed51de2c55129a49113 | |
| parent | cba4a389b3961a2fd72e01bd6cb0b0e065edaf3d (diff) | |
| parent | 614c2e404a2eae63c2f392fd90e98960b6ec59bc (diff) | |
| download | rust-5377c3112288a759d29f9b9e916fb45da35f51c3.tar.gz rust-5377c3112288a759d29f9b9e916fb45da35f51c3.zip | |
Rollup merge of #89891 - ojeda:modular-alloc, r=Mark-Simulacrum
`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. See https://github.com/rust-lang/rust/pull/86048 and https://github.com/rust-lang/rust/pull/84266 for similar requests. Of course, the particular names are not important.
| -rw-r--r-- | library/alloc/src/lib.rs | 9 | ||||
| -rw-r--r-- | src/bootstrap/lib.rs | 2 | ||||
| -rw-r--r-- | src/test/run-make-fulldeps/alloc-no-rc/Makefile | 4 | ||||
| -rw-r--r-- | src/test/run-make-fulldeps/alloc-no-sync/Makefile | 4 |
4 files changed, 16 insertions, 3 deletions
diff --git a/library/alloc/src/lib.rs b/library/alloc/src/lib.rs index ce71cd600fc..6b3b1c22222 100644 --- a/library/alloc/src/lib.rs +++ b/library/alloc/src/lib.rs @@ -69,6 +69,8 @@ any(not(feature = "miri-test-libstd"), test, doctest), no_global_oom_handling, not(no_global_oom_handling), + not(no_rc), + not(no_sync), target_has_atomic = "ptr" ))] #![no_std] @@ -225,16 +227,17 @@ mod boxed { } pub mod borrow; 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 fmt; +#[cfg(not(no_rc))] pub mod rc; pub mod slice; pub mod str; pub mod string; -#[cfg(target_has_atomic = "ptr")] +#[cfg(all(not(no_rc), not(no_sync), target_has_atomic = "ptr"))] 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; #[cfg(test)] mod tests; diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs index b7d271e6494..0464dbde065 100644 --- a/src/bootstrap/lib.rs +++ b/src/bootstrap/lib.rs @@ -201,6 +201,8 @@ const EXTRA_CHECK_CFGS: &[(Option<Mode>, &'static str, Option<&[&'static str]>)] (Some(Mode::Std), "stdarch_intel_sde", None), (Some(Mode::Std), "no_fp_fmt_parse", 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), "backtrace_in_libstd", None), /* Extra values not defined in the built-in targets yet, but used in std */ diff --git a/src/test/run-make-fulldeps/alloc-no-rc/Makefile b/src/test/run-make-fulldeps/alloc-no-rc/Makefile new file mode 100644 index 00000000000..5f7ae70fa02 --- /dev/null +++ b/src/test/run-make-fulldeps/alloc-no-rc/Makefile @@ -0,0 +1,4 @@ +include ../tools.mk + +all: + $(RUSTC) --edition=2021 -Dwarnings --crate-type=rlib ../../../../library/alloc/src/lib.rs --cfg no_rc diff --git a/src/test/run-make-fulldeps/alloc-no-sync/Makefile b/src/test/run-make-fulldeps/alloc-no-sync/Makefile new file mode 100644 index 00000000000..6a258a2ddfd --- /dev/null +++ b/src/test/run-make-fulldeps/alloc-no-sync/Makefile @@ -0,0 +1,4 @@ +include ../tools.mk + +all: + $(RUSTC) --edition=2021 -Dwarnings --crate-type=rlib ../../../../library/alloc/src/lib.rs --cfg no_sync |
