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

[dogfooding] -Zbuild-std -vv produces lots of warnings about check-cfg #125291

Closed
tesuji opened this issue May 19, 2024 · 0 comments · Fixed by #125296
Closed

[dogfooding] -Zbuild-std -vv produces lots of warnings about check-cfg #125291

tesuji opened this issue May 19, 2024 · 0 comments · Fixed by #125296
Labels
-Zbuild-std Unstable Cargo option: Compile the standard library yourself. C-bug Category: This is a bug. F-check-cfg --check-cfg T-cargo Relevant to the cargo team, which will review and decide on the PR/issue.

Comments

@tesuji
Copy link
Contributor

tesuji commented May 19, 2024

With extra verbose flag (-vv), one would see a lots of warnings about check-cfg when building -Zbuild-std.
But it doesn't need to be that way.

Can we doodfooding check-cfg flag to Cargo.toml and build.rs to resolve them?

Step to reproduce:

cargo new dummy && cd dummy
cargo build -Zbuild-std=core --target=x86_64-unknown-linux-gnu -vv

I expected to see this happen: No warnings about " unexpected cfg"

Some are:

2024-05-19T18:46:23.3979433Z warning: unexpected `cfg` condition name: `no_fp_fmt_parse`
2024-05-19T18:46:23.3980468Z   --> /home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/num/mod.rs:57:11
2024-05-19T18:46:23.3981241Z    |
2024-05-19T18:46:23.3981518Z 57 | #[cfg(not(no_fp_fmt_parse))]
2024-05-19T18:46:23.3981960Z    |           ^^^^^^^^^^^^^^^
2024-05-19T18:46:23.3982267Z    |
2024-05-19T18:46:23.3983114Z    = help: consider using a Cargo feature instead or adding `println!("cargo::rustc-check-cfg=cfg(no_fp_fmt_parse)");` to the top of the `build.rs`
2024-05-19T18:46:23.3984658Z    = note: see <https://doc.rust-lang.org/nightly/cargo/reference/build-scripts.html#rustc-check-cfg> for more information about checking conditional configuration
2024-05-19T18:46:23.3985452Z 
2024-05-19T18:46:23.3999470Z warning: unexpected `cfg` condition name: `bootstrap`
2024-05-19T18:46:23.4001329Z    --> /home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/intrinsics.rs:990:16
2024-05-19T18:46:23.4002762Z     |
2024-05-19T18:46:23.4003512Z 990 | #[cfg_attr(not(bootstrap), miri::intrinsic_fallback_checks_ub)]
2024-05-19T18:46:23.4004371Z     |                ^^^^^^^^^
2024-05-19T18:46:23.4004969Z     |
2024-05-19T18:46:23.4006329Z     = help: consider using a Cargo feature instead or adding `println!("cargo::rustc-check-cfg=cfg(bootstrap)");` to the top of the `build.rs`
2024-05-19T18:46:23.4008775Z     = note: see <https://doc.rust-lang.org/nightly/cargo/reference/build-scripts.html#rustc-check-cfg> for more information about checking conditional configuration
2024-05-19T18:46:23.4010415Z 

@rustbot label +F-check-cfg +-Zbuild-std
cc @Urgau

@tesuji tesuji added the C-bug Category: This is a bug. label May 19, 2024
@rustbot rustbot added needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. -Zbuild-std Unstable Cargo option: Compile the standard library yourself. F-check-cfg --check-cfg labels May 19, 2024
@saethlin saethlin added T-cargo Relevant to the cargo team, which will review and decide on the PR/issue. and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels May 19, 2024
@bors bors closed this as completed in 8219fd2 May 22, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this issue May 22, 2024
Rollup merge of rust-lang#125296 - tesuji:checkcfg-buildstd, r=Nilstrieb,michaelwoerister

Fix `unexpected_cfgs` lint on std

closes rust-lang#125291

r? rust-lang/compiler
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. F-check-cfg --check-cfg T-cargo Relevant to the cargo team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants