Skip to content

Commit a0538c8

Browse files
authored
Rollup merge of rust-lang#56986 - alexcrichton:move-jemalloc, r=Mark-Simulacrum
rustc: Move jemalloc from rustc_driver to rustc This commit moves jemalloc to just the rustc binary rather than the rustc_driver shared library, enusring that it's only used for binaries that opt-in to it like rustc rather than other binaries using librustc_driver like rustdoc/rls/etc. This will hopefully address rust-lang#56980
2 parents 51f90a1 + ba0ed5b commit a0538c8

File tree

5 files changed

+15
-15
lines changed

5 files changed

+15
-15
lines changed

Cargo.lock

+1-1
Original file line numberDiff line numberDiff line change
@@ -2216,6 +2216,7 @@ dependencies = [
22162216
name = "rustc-main"
22172217
version = "0.0.0"
22182218
dependencies = [
2219+
"jemalloc-sys 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
22192220
"rustc_codegen_ssa 0.0.0",
22202221
"rustc_driver 0.0.0",
22212222
"rustc_target 0.0.0",
@@ -2402,7 +2403,6 @@ dependencies = [
24022403
"arena 0.0.0",
24032404
"env_logger 0.5.13 (registry+https://github.com/rust-lang/crates.io-index)",
24042405
"graphviz 0.0.0",
2405-
"jemalloc-sys 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
24062406
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
24072407
"rustc 0.0.0",
24082408
"rustc-rayon 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",

src/librustc_driver/Cargo.toml

-5
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,3 @@ syntax = { path = "../libsyntax" }
3838
smallvec = { version = "0.6.7", features = ["union", "may_dangle"] }
3939
syntax_ext = { path = "../libsyntax_ext" }
4040
syntax_pos = { path = "../libsyntax_pos" }
41-
42-
[dependencies.jemalloc-sys]
43-
version = '0.1.8'
44-
optional = true
45-
features = ['unprefixed_malloc_on_supported_platforms']

src/librustc_driver/lib.rs

-8
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,6 @@ extern crate syntax;
6363
extern crate syntax_ext;
6464
extern crate syntax_pos;
6565

66-
// Note that the linkage here should be all that we need, on Linux we're not
67-
// prefixing the symbols here so this should naturally override our default
68-
// allocator. On OSX it should override via the zone allocator. We shouldn't
69-
// enable this by default on other platforms, so other platforms aren't handled
70-
// here yet.
71-
#[cfg(feature = "jemalloc-sys")]
72-
extern crate jemalloc_sys;
73-
7466
use driver::CompileController;
7567
use pretty::{PpMode, UserIdentifiedItem};
7668

src/rustc/Cargo.toml

+6-1
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,10 @@ rustc_driver = { path = "../librustc_driver" }
1515
# crate is intended to be used by codegen backends, which may not be in-tree.
1616
rustc_codegen_ssa = { path = "../librustc_codegen_ssa" }
1717

18+
[dependencies.jemalloc-sys]
19+
version = '0.1.8'
20+
optional = true
21+
features = ['unprefixed_malloc_on_supported_platforms']
22+
1823
[features]
19-
jemalloc = ['rustc_driver/jemalloc-sys']
24+
jemalloc = ['jemalloc-sys']

src/rustc/rustc.rs

+8
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,14 @@ extern {}
2323

2424
extern crate rustc_driver;
2525

26+
// Note that the linkage here should be all that we need, on Linux we're not
27+
// prefixing the symbols here so this should naturally override our default
28+
// allocator. On OSX it should override via the zone allocator. We shouldn't
29+
// enable this by default on other platforms, so other platforms aren't handled
30+
// here yet.
31+
#[cfg(feature = "jemalloc-sys")]
32+
extern crate jemalloc_sys;
33+
2634
fn main() {
2735
rustc_driver::set_sigpipe_handler();
2836
rustc_driver::main()

0 commit comments

Comments
 (0)