Skip to content

Commit b723bad

Browse files
committed
std: Always use alloc_system in stage0 so snaps work with --disable-jemalloc
1 parent 6f706a5 commit b723bad

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/libstd/lib.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,10 @@
268268
#![feature(vec_push_all)]
269269
#![feature(wrapping)]
270270
#![feature(zero_one)]
271+
// Snapshots are configured to link jemalloc by default, which makes
272+
// CFG_DISABLE_JEMALLOC break in stage0 because alloc_jemalloc doesn't exist.
273+
// This forces stage0 to always use the system allocator.
274+
#![cfg_attr(stage0, feature(alloc_system))]
271275

272276
// Don't link to std. We are std.
273277
#![no_std]
@@ -285,6 +289,11 @@
285289
unreachable, unimplemented, write, writeln, try)]
286290
extern crate core as __core;
287291

292+
// Snapshots are configured to link jemalloc by default, which makes
293+
// CFG_DISABLE_JEMALLOC break in stage0 because alloc_jemalloc doesn't exist.
294+
// This forces stage0 to always use the system allocator.
295+
#[cfg(stage0)] extern crate alloc_system;
296+
288297
#[macro_use]
289298
#[macro_reexport(vec, format)]
290299
extern crate collections as core_collections;

0 commit comments

Comments
 (0)