-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Fix unexpected_cfgs
lint on std
#125296
Fix unexpected_cfgs
lint on std
#125296
Conversation
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. |
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. |
library/std/Cargo.toml
Outdated
@@ -82,6 +82,7 @@ system-llvm-libunwind = ["unwind/system-llvm-libunwind"] | |||
|
|||
# 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
I see, makes sense, bootstrapping exists :D. r=me after removing the Cargo feature again. |
|
||
[lints.rust.unexpected_cfgs] | ||
level = "warn" | ||
check-cfg = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
@rustbot ready |
@bors r=Nilstrieb,michaelwoerister |
@bors r=Nilstrieb,michaelwoerister |
…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
☔ 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.
@bors r=Nilstrieb,michaelwoerister |
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 closes rust-lang#125291 r? rust-lang/compiler
bors sleepy @bors r- |
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` Fixes rust-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` Fixes rust-lang#125296 (comment) r? `@bjorn3` (maybe, feel free to re-roll)
closes #125291
r? rust-lang/compiler