Skip to content

stage0 libstd fails to build when jemalloc is disabled #43510

Closed
@cuviper

Description

@cuviper

Since #43320 bumped the bootstrap compiler, stage0 libstd fails to build when jemalloc is disabled:

error[E0463]: can't find crate for `alloc_jemalloc`

error: aborting due to previous error

error: Could not compile `std`.

I believe it needs to restore the logic removed here:
https://github.com/rust-lang/rust/pull/42727/files#diff-242481015141f373dcb178e93cffa850L236

I tried to add this to libstd/lib.rs:

// Always use alloc_system during stage0 since we don't know if the alloc_*
// crate the stage0 compiler will pick by default is available (most
// obviously, if the user has disabled jemalloc in `./configure`).
#![cfg_attr(any(stage0, feature = "force_alloc_system"), feature(global_allocator))]
#![cfg(any(stage0, feature = "force_alloc_system"))]
#[global_allocator]
static ALLOC: alloc_system::System = alloc_system::System;

Then stage0 passed, but stage1 std failed like:

error[E0463]: can't find crate for `std`

error: aborting due to previous error

error: Could not compile `std`.

😕

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions