Uh oh!
There was an error while loading. Please reload this page.
Fix unexpected_cfgs lint on std - #125296
Conversation
rustbot
commented
May 19, 2024
Failed to set assignee to
|
can you find the place in src/bootstrap where it sets the check-cfg for std and attempt to remove it? That would be a simple way to ensure they continue to work. |
Urgau
commented
May 20, 2024
This is great, thanks.
It won't work for now for this repository as we always build with the previous beta Cargo, and it doesn't know about the Lines 87 to 97 in f092f73 Further more there is currently a warning that is emitted on previous beta Cargo since We are working on getting this warning removed on beta Cargo, rust-lang/cargo#13925. |
| # Make panics and failed asserts immediately abort without formatting any message | ||
| panic_immediate_abort = ["core/panic_immediate_abort", "alloc/panic_immediate_abort"] | ||
| restricted-std = [] |
There was a problem hiding this comment.
this doesn't really make sense as a feature, using a feature = cfg is a bit weird.. could you put it into the check-cfg table instead of the feature here as well?
There was a problem hiding this comment.
If it shouldn't be activated by users, then it shouldn't be Cargo feature to begin with, it should just be a normal "custom cfg": restricted_std.
T-cargo is also thinking of disallowing/warning when expecting a fake Cargo feature, https://rust-lang.zulipchat.com/#narrow/stream/246057-t-cargo/topic/.60check-cfg.60.20and.20custom.20.60feature.60
Noratrieb
commented
May 20, 2024
I see, makes sense, bootstrapping exists :D. r=me after removing the Cargo feature again. |
Uh oh!
There was an error while loading. Please reload this page.
| [lints.rust.unexpected_cfgs] | ||
| level = "warn" | ||
| check-cfg = [ |
There was a problem hiding this comment.
Could you add a comment saying that these check-cfg entries do not yet take effect for rust-lang/rust since we use beta Cargo, but that for users for -Zbuild-std it does take effect and that the unused warning in waiting for rust-lang/cargo#13925 to reach beta.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
@rustbot ready |
michaelwoerister
commented
May 21, 2024
@bors r=Nilstrieb,michaelwoerister |
bors
commented
May 21, 2024
Uh oh!
There was an error while loading. Please reload this page.
Noratrieb
commented
May 21, 2024
@bors r=Nilstrieb,michaelwoerister |
bors
commented
May 21, 2024
…iaskrgr Rollup of 7 pull requests Successful merges: - rust-lang#124570 (Miscellaneous cleanups) - rust-lang#124772 (Refactor documentation for Apple targets) - rust-lang#125011 (Add opt-for-size core lib feature flag) - rust-lang#125218 (Migrate `run-make/no-intermediate-extras` to new `rmake.rs`) - rust-lang#125225 (Use functions from `crt_externs.h` on iOS/tvOS/watchOS/visionOS) - rust-lang#125266 (compiler: add simd_ctpop intrinsic) - rust-lang#125348 (Small fixes to `std::path::absolute` docs) Failed merges: - rust-lang#125296 (Fix `unexpected_cfgs` lint on std) r? `@ghost` `@rustbot` modify labels: rollup
bors
commented
May 21, 2024
☔ The latest upstream changes (presumably #125358) made this pull request unmergeable. Please resolve the merge conflicts. |
This comment was marked as resolved.
This comment was marked as resolved.
michaelwoerister
commented
May 21, 2024
@bors r=Nilstrieb,michaelwoerister |
bors
commented
May 21, 2024
Rollup of 5 pull requests Successful merges: - rust-lang#124896 (miri: rename intrinsic_fallback_checks_ub to intrinsic_fallback_is_spec) - rust-lang#125015 (Pattern types: Prohibit generic args on const params) - rust-lang#125049 (Disallow cast with trailing braced macro in let-else) - rust-lang#125259 (An async closure may implement `FnMut`/`Fn` if it has no self-borrows) - rust-lang#125296 (Fix `unexpected_cfgs` lint on std) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#125296 - tesuji:checkcfg-buildstd, r=Nilstrieb,michaelwoerister Fix `unexpected_cfgs` lint on std closesrust-lang#125291 r? rust-lang/compiler
fmease
commented
May 22, 2024
bors sleepy @bors r- |
bjorn3
commented
May 23, 2024
I'm still getting warning: unexpected `cfg` condition value: `restricted-std`
--> library/std/src/lib.rs:216:17
|
216 | #![cfg_attr(not(feature = "restricted-std"), stable(feature = "rust1", since = "1.0.0"))]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: expected values for `feature` are: `addr2line`, `as_crate`, `backtrace`, `compiler-builtins-c`, `compiler-builtins-mangled-names`, `compiler-builtins-mem`, `compiler-builtins-no-asm`, `compiler-builtins-weak-intrinsics`, `llvm-libunwind`, `miniz_oxide`, `object`, `optimize_for_size`, `panic-unwind`, `panic_immediate_abort`, `panic_unwind`, `profiler`, `profiler_builtins`, `std`, `std_detect_dlsym_getauxval`, `std_detect_env_override`, `std_detect_file_io`, and `system-llvm-libunwind`
= help: consider adding `restricted-std` as a feature in `Cargo.toml`
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration
= note: requested on the command line with `-W unexpected-cfgs`
warning: unexpected `cfg` condition value: `restricted-std`
--> library/std/src/lib.rs:218:5
|
218 | feature = "restricted-std",
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: expected values for `feature` are: `addr2line`, `as_crate`, `backtrace`, `compiler-builtins-c`, `compiler-builtins-mangled-names`, `compiler-builtins-mem`, `compiler-builtins-no-asm`, `compiler-builtins-weak-intrinsics`, `llvm-libunwind`, `miniz_oxide`, `object`, `optimize_for_size`, `panic-unwind`, `panic_immediate_abort`, `panic_unwind`, `profiler`, `profiler_builtins`, `std`, `std_detect_dlsym_getauxval`, `std_detect_env_override`, `std_detect_file_io`, and `system-llvm-libunwind`
= help: consider adding `restricted-std` as a feature in `Cargo.toml`
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration
warning: `std` (lib) generated 2 warnings |
@bjorn3 that's #125296 (comment), I think it would make sense to switch to |
… r=bjorn3 Cleanup check-cfg handling in core and std Follow-up to rust-lang#125296 where we: - expect any feature cfg in std, due to `#[path]` imports - move some check-cfg args inside the `build.rs` as per Cargo recommendation - and replace the fake Cargo feature `"restricted-std"` by the custom cfg `restricted_std` Fixesrust-lang#125296 (comment) r? `@bjorn3` (maybe, feel free to re-roll)
Rollup merge of rust-lang#125452 - Urgau:check-cfg-libraries-cleanup, r=bjorn3 Cleanup check-cfg handling in core and std Follow-up to rust-lang#125296 where we: - expect any feature cfg in std, due to `#[path]` imports - move some check-cfg args inside the `build.rs` as per Cargo recommendation - and replace the fake Cargo feature `"restricted-std"` by the custom cfg `restricted_std` Fixesrust-lang#125296 (comment) r? `@bjorn3` (maybe, feel free to re-roll)
closes#125291
r? rust-lang/compiler