Skip to content

Commit 55dd595

Browse files
committed
rustc_back: Fix disabling jemalloc
When building with Cargo we need to detect `feature = "jemalloc"` to enable jemalloc, so propagate this same change to the build system to pass the right `--cfg` argument.
1 parent bb2e921 commit 55dd595

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

mk/crates.mk

+1-2
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,7 @@ TARGET_CRATES += alloc_jemalloc
144144
DEPS_std += alloc_jemalloc
145145
DEPS_alloc_jemalloc := core libc native:jemalloc
146146
ONLY_RLIB_alloc_jemalloc := 1
147-
else
148-
RUSTFLAGS_rustc_back := --cfg disable_jemalloc
147+
RUSTFLAGS_rustc_back := --cfg 'feature="jemalloc"'
149148
endif
150149

151150
################################################################################

src/librustc_back/target/mod.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -501,9 +501,9 @@ impl Target {
501501
}
502502

503503
fn maybe_jemalloc() -> String {
504-
if cfg!(disable_jemalloc) {
505-
"alloc_system".to_string()
506-
} else {
504+
if cfg!(feature = "jemalloc") {
507505
"alloc_jemalloc".to_string()
506+
} else {
507+
"alloc_system".to_string()
508508
}
509509
}

0 commit comments

Comments
 (0)