Skip to content

Commit 458ba7a

Browse files
committed
Make a disable-jemalloc build work
Fixes #43510
1 parent e8f5585 commit 458ba7a

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/libstd/lib.rs

+10
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,16 @@
318318

319319
#![default_lib_allocator]
320320

321+
// Always use alloc_system during stage0 since we don't know if the alloc_*
322+
// crate the stage0 compiler will pick by default is available (most
323+
// obviously, if the user has disabled jemalloc in `./configure`).
324+
// `force_alloc_system` is *only* intended as a workaround for local rebuilds
325+
// with a rustc without jemalloc.
326+
#![cfg_attr(any(stage0, feature = "force_alloc_system"), feature(global_allocator))]
327+
#[cfg(any(stage0, feature = "force_alloc_system"))]
328+
#[global_allocator]
329+
static ALLOC: alloc_system::System = alloc_system::System;
330+
321331
// Explicitly import the prelude. The compiler uses this same unstable attribute
322332
// to import the prelude implicitly when building crates that depend on std.
323333
#[prelude_import]

0 commit comments

Comments
 (0)