-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Workspace unexpected-cfg lint configuration does not apply to integration test. #13944
Comments
Hmm, I'm not able to reproduce this with cargo 1.80.0-nightly (0de7f2e 2024-05-17) I went a step further and have Without the lint config, I get $ cargo check --all-targets
warning: unexpected `cfg` condition name: `biscuits`
--> unexpected/tests/test.rs:1:8
|
1 | #![cfg(biscuits)]
| ^^^^^^^^
|
= help: expected names are: `clippy`, `debug_assertions`, `doc`, `docsrs`, `doctest`, `feature`, `miri`, `overflow_c
hecks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `saniti
zer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feat
ure`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_p
ointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, `windows`
= help: consider using a Cargo feature instead
= help: or consider adding in `Cargo.toml` the `check-cfg` lint config for the lint:
[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(biscuits)'] }
= help: or consider adding `println!("cargo::rustc-check-cfg=cfg(biscuits)");` to the top of the `build.rs`
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about chec
king conditional configuration
= note: `#[warn(unexpected_cfgs)]` on by default
warning: unexpected `cfg` condition name: `biscuits`
--> unexpected/src/main.rs:2:12
|
2 | #![cfg(biscuits)]
| ^^^^^^^^
|
= help: expected names are: `clippy`, `debug_assertions`, `doc`, `docsrs`, `doctest`, `feature`, `miri`, `overflow_c
hecks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `saniti
zer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feat
ure`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_p
ointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, `windows`
= help: consider using a Cargo feature instead
= help: or consider adding in `Cargo.toml` the `check-cfg` lint config for the lint:
[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(biscuits)'] }
= help: or consider adding `println!("cargo::rustc-check-cfg=cfg(biscuits)");` to the top of the `build.rs`
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about chec
king conditional configuration
= note: `#[warn(unexpected_cfgs)]` on by default
warning: unexpected `cfg` condition name: `biscuits`
--> unexpected/src/main.rs:7:12
|
7 | #![cfg(biscuits)]
| ^^^^^^^^
|
= help: consider using a Cargo feature instead
= help: or consider adding in `Cargo.toml` the `check-cfg` lint config for the lint:
[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(biscuits)'] }
= help: or consider adding `println!("cargo::rustc-check-cfg=cfg(biscuits)");` to the top of the `build.rs`
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about chec
king conditional configuration
warning: `unexpected` (test "test") generated 1 warning
warning: `unexpected` (bin "unexpected") generated 1 warning
warning: `unexpected` (bin "unexpected" test) generated 2 warnings (1 duplicate)
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.02s with the lint config I get $ cargo +nightly check --all-targets
Checking unexpected v0.1.0 (/home/epage/src/personal/dump/cargo-13944/unexpected)
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.02s Running |
Note that the issue at one point mentions |
Ah, it seems I was missing the |
Problem
When using the workspace lints table to set
rust.unexpected-cfg
, integration tests appear to ignore the configuration.Steps
Workspace Cargo.toml:
Add a workspace crate called "unexpected" with an
unexpected/tests/test.rs
file:#![cfg(biscuits)]
Running
cargo +nightly test
will warn about the unexpected cfg even though it's set.Possible Solution(s)
No response
Notes
No response
Version
The text was updated successfully, but these errors were encountered: