Closed
Description
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