rust-lang / rust-lang/rust

`-Zbuild-std` shouldn't explode on compiler-builtins fragility

Open
#137,222 31 comments 0 reactions 1 assignee View on GitHub

@saethlin is already working on this.

Since Dec 24, 2025.

-Zbuild-std A-linkage C-bug T-compiler T-libs
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.