Compile error with build-std=std

Hello,
I've tried to recompile again an old crate, with a newer rustc version.
The code is unchanged, but when compiling with RUSTFLAGS="" cargo +nightly build --profile=release --target=aarch64-unknown-none-softfloat -Z build-std=std,panic_abort I have the following error:

   Compiling std v0.0.0 (/home/peshel/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std)
error: `sys_common::once::generic::Once::new` is not yet stable as a const fn
  --> /home/peshel/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sync/once.rs:70:23
   |
70 |         Once { inner: sys::Once::new() }
   |                       ^^^^^^^^^^^^^^^^
   |
   = help: const-stable functions can only call other const-stable functions

Did something change about building the restricted std on a per crate basis? How can I make it work again?

Saw this too. Filed libstd: -Z build-std is newly broken for, e.g., x86_64-unknown-none · Issue #103191 · rust-lang/rust · GitHub.

1 Like

For reference, this is now fixed from at least version 1.68.0-nightly