Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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 opened this issue Oct 18, 2022 · 1 comment
Labels
-Zbuild-std Unstable Cargo option: Compile the standard library yourself. C-bug Category: This is a bug.

Comments

@krasimirgg
Copy link
Contributor

krasimirgg commented Oct 18, 2022

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.

@krasimirgg krasimirgg added the C-bug Category: This is a bug. label Oct 18, 2022
@krasimirgg krasimirgg changed the title libstd: -Z build-std is newly broken for, e.g., x86_64-unknown-none 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 Oct 18, 2022
@krasimirgg krasimirgg changed the title 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 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 Oct 18, 2022
Manishearth added a commit to Manishearth/rust that referenced this issue Nov 22, 2022
mark sys_common::once::generic::Once::new const-stable

Attempt to address rust-lang#103191 by marking the impl const-stable.
Picked the declaration from the callsite:
https://github.com/rust-lang/rust/blob/21b246587c2687935bd6004ffa5dcc4f4dd6600d/library/std/src/sync/once.rs#L67

This is similar to rust-lang#98457.

With this in, `python3 x.py build library/std --target x86_64-unknown-none` succeeds.
thomcc pushed a commit to tcdi/postgrestd that referenced this issue Feb 10, 2023
mark sys_common::once::generic::Once::new const-stable

Attempt to address rust-lang/rust#103191 by marking the impl const-stable.
Picked the declaration from the callsite:
https://github.com/rust-lang/rust/blob/21b246587c2687935bd6004ffa5dcc4f4dd6600d/library/std/src/sync/once.rs#L67

This is similar to rust-lang/rust#98457.

With this in, `python3 x.py build library/std --target x86_64-unknown-none` succeeds.
@workingjubilee workingjubilee added the -Zbuild-std Unstable Cargo option: Compile the standard library yourself. label Mar 13, 2023
@jyn514
Copy link
Member

jyn514 commented Apr 27, 2023

This was fixed in #103193.

@jyn514 jyn514 closed this as completed Apr 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
-Zbuild-std Unstable Cargo option: Compile the standard library yourself. C-bug Category: This is a bug.
Projects
None yet
Development

No branches or pull requests

3 participants