Skip to content

Commit 43e3c02

Browse files
committed
rust: alloc: move CONFIG_RUST uses to custom no_* feature flags
This should be closer to what upstream would eventually need to have to support us, i.e. a more modular `alloc`. Suggested-by: Gary Guo <[email protected]> Signed-off-by: Miguel Ojeda <[email protected]>
1 parent c27ccb5 commit 43e3c02

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

rust/Makefile

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@ else
2828
cargo_quiet=--verbose
2929
endif
3030

31+
alloc-cfgs = \
32+
--cfg no_global_oom_handling \
33+
--cfg no_rc \
34+
--cfg no_sync
35+
3136
quiet_cmd_rustdoc = RUSTDOC $(if $(rustdoc_host),H, ) $<
3237
cmd_rustdoc = \
3338
OBJTREE=$(abspath $(objtree)) \
@@ -62,7 +67,7 @@ rustdoc-compiler_builtins: $(srctree)/rust/compiler_builtins.rs rustdoc-core FOR
6267
# `no_global_oom_handling` functions refer to non-`no_global_oom_handling`
6368
# functions. Ideally `rustdoc` would have a way to distinguish broken links
6469
# due to things that are "configured out" vs. entirely non-existing ones.
65-
rustdoc-alloc: private rustc_target_flags = --cfg no_global_oom_handling \
70+
rustdoc-alloc: private rustc_target_flags = $(alloc-cfgs) \
6671
-Abroken_intra_doc_links
6772
rustdoc-alloc: $(srctree)/rust/alloc/lib.rs rustdoc-core \
6873
rustdoc-compiler_builtins FORCE
@@ -304,7 +309,7 @@ $(objtree)/rust/compiler_builtins.o: $(srctree)/rust/compiler_builtins.rs \
304309
$(call if_changed_dep,rustc_library)
305310

306311
$(objtree)/rust/alloc.o: private skip_clippy = 1
307-
$(objtree)/rust/alloc.o: private rustc_target_flags = --cfg no_global_oom_handling
312+
$(objtree)/rust/alloc.o: private rustc_target_flags = $(alloc-cfgs)
308313
$(objtree)/rust/alloc.o: $(srctree)/rust/alloc/lib.rs \
309314
$(objtree)/rust/compiler_builtins.o FORCE
310315
$(call if_changed_dep,rustc_library)

rust/alloc/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,12 +180,12 @@ pub mod collections;
180180
pub mod fmt;
181181
pub mod prelude;
182182
pub mod raw_vec;
183-
#[cfg(not(CONFIG_RUST))]
183+
#[cfg(not(no_rc))]
184184
pub mod rc;
185185
pub mod slice;
186186
pub mod str;
187187
pub mod string;
188-
#[cfg(all(target_has_atomic = "ptr", not(CONFIG_RUST)))]
188+
#[cfg(all(not(no_sync), target_has_atomic = "ptr"))]
189189
pub mod sync;
190190
#[cfg(all(not(no_global_oom_handling), target_has_atomic = "ptr"))]
191191
pub mod task;

0 commit comments

Comments
 (0)