Skip to content

Commit a06255e

Browse files
authored
Rollup merge of rust-lang#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 rust-lang#86048 and rust-lang#84266 for similar requests. Of course, the particular names are not important.
2 parents cba4a38 + 614c2e4 commit a06255e

File tree

4 files changed

+16
-3
lines changed

4 files changed

+16
-3
lines changed

library/alloc/src/lib.rs

+6-3
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]
@@ -225,16 +227,17 @@ mod boxed {
225227
}
226228
pub mod borrow;
227229
pub mod collections;
228-
#[cfg(not(no_global_oom_handling))]
230+
#[cfg(all(not(no_rc), not(no_sync), not(no_global_oom_handling)))]
229231
pub mod ffi;
230232
pub mod fmt;
233+
#[cfg(not(no_rc))]
231234
pub mod rc;
232235
pub mod slice;
233236
pub mod str;
234237
pub mod string;
235-
#[cfg(target_has_atomic = "ptr")]
238+
#[cfg(all(not(no_rc), not(no_sync), target_has_atomic = "ptr"))]
236239
pub mod sync;
237-
#[cfg(all(not(no_global_oom_handling), target_has_atomic = "ptr"))]
240+
#[cfg(all(not(no_global_oom_handling), not(no_rc), not(no_sync), target_has_atomic = "ptr"))]
238241
pub mod task;
239242
#[cfg(test)]
240243
mod tests;

src/bootstrap/lib.rs

+2
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,8 @@ const EXTRA_CHECK_CFGS: &[(Option<Mode>, &'static str, Option<&[&'static str]>)]
201201
(Some(Mode::Std), "stdarch_intel_sde", None),
202202
(Some(Mode::Std), "no_fp_fmt_parse", None),
203203
(Some(Mode::Std), "no_global_oom_handling", None),
204+
(Some(Mode::Std), "no_rc", None),
205+
(Some(Mode::Std), "no_sync", None),
204206
(Some(Mode::Std), "freebsd12", None),
205207
(Some(Mode::Std), "backtrace_in_libstd", None),
206208
/* Extra values not defined in the built-in targets yet, but used in std */
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
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)