Skip to content

libstd: -Z build-std is newly broken for, e.g., x86_64-unknown-none; error: sys_common::once::generic::Once::new is not yet stable as a const fn #103191

Closed
@krasimirgg

Description

@krasimirgg

Recent occurrence similar to #98378, example adapted from there:

% cat run.sh 
#!/bin/bash
rustup default nightly-2022-10-17
rustup component add rust-src
cargo new --lib foo 
cd foo
echo '#![no_std]' > src/lib.rs
cargo build -Z build-std --target x86_64-unknown-none
% ./run.sh 
...
error: `sys_common::once::generic::Once::new` is not yet stable as a const fn
  --> ~/.rustup/toolchains/nightly-2022-10-17-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

error: could not compile `std` due to previous error

I can repro the same error via x.py:

python3 x.py build library/std --target x86_64-unknown-none

https://users.rust-lang.org/t/compile-error-with-build-std-std/82696 mentions the same error.

I'll see if something similar to #98457 resolves this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    -Zbuild-stdUnstable Cargo option: Compile the standard library yourself.C-bugCategory: This is a bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions