Skip to content

-Zbuild-std shouldn't explode on compiler-builtins fragility #137222

Open
@0xdeafbeef

Description

@0xdeafbeef

I tried this code:

 rustup install nightly
 rustup component add rust-src --toolchain nightly-x86_64-unknown-linux-gnu
 cd $(mktemp -d) && cargo new aaaa && cd aaaa
RUSTFLAGS="-Clink-dead-code" "cargo" "build"   "--target" "x86_64-unknown-linux-gnu" "--release" "--config" "profile.release.debug=true" "-Z" "build-std"

get this error:

   Compiling compiler_builtins v0.1.146
   Compiling alloc v0.0.0 (/home/odm3n/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc)
   Compiling cfg-if v1.0.0
   Compiling adler2 v2.0.0
   Compiling memchr v2.7.4
   Compiling rustc-demangle v0.1.24
   Compiling unwind v0.0.0 (/home/odm3n/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/unwind)
error: `compiler_builtins` cannot call functions through upstream monomorphizations; encountered invalid call from `<int::big::u256 as rustc_std_workspace_core::fmt::Debug>::fmt` to `rustc_std_workspace_core::fmt::Formatter::<'a>::debug_tuple_field1_finish`

error: `compiler_builtins` cannot call functions through upstream monomorphizations; encountered invalid call from `<int::big::i256 as rustc_std_workspace_core::fmt::Debug>::fmt` to `rustc_std_workspace_core::fmt::Formatter::<'a>::debug_tuple_field1_finish`

error: could not compile `compiler_builtins` (lib) due to 2 previous errors

Meta

rustc --version --verbose:

rustc 1.87.0-nightly (ce36a966c 2025-02-17)
binary: rustc
commit-hash: ce36a966c79e109dabeef7a47fe68e5294c6d71e
commit-date: 2025-02-17
host: x86_64-unknown-linux-gnu
release: 1.87.0-nightly
LLVM version: 20.1.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    -Zbuild-stdUnstable Cargo option: Compile the standard library yourself.A-linkageArea: linking into static, shared libraries and binariesC-bugCategory: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.T-libsRelevant to the library 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