Skip to content

Commit

Permalink
rustc_back: Fix disabling jemalloc
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
alexcrichton committed Feb 11, 2016
1 parent bb2e921 commit 55dd595
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
3 changes: 1 addition & 2 deletions mk/crates.mk
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,7 @@ TARGET_CRATES += alloc_jemalloc
DEPS_std += alloc_jemalloc
DEPS_alloc_jemalloc := core libc native:jemalloc
ONLY_RLIB_alloc_jemalloc := 1
else
RUSTFLAGS_rustc_back := --cfg disable_jemalloc
RUSTFLAGS_rustc_back := --cfg 'feature="jemalloc"'
endif

################################################################################
Expand Down
6 changes: 3 additions & 3 deletions src/librustc_back/target/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -501,9 +501,9 @@ impl Target {
}

fn maybe_jemalloc() -> String {
if cfg!(disable_jemalloc) {
"alloc_system".to_string()
} else {
if cfg!(feature = "jemalloc") {
"alloc_jemalloc".to_string()
} else {
"alloc_system".to_string()
}
}

0 comments on commit 55dd595

Please sign in to comment.