Filter well known names from check-cfg diagnostics
This commit is contained in:
parent
c08cc61bdd
commit
c5ea75a5df
24 changed files with 98 additions and 42 deletions
|
@ -10,19 +10,35 @@ use crate::lints;
|
|||
|
||||
const MAX_CHECK_CFG_NAMES_OR_VALUES: usize = 35;
|
||||
|
||||
enum FilterWellKnownNames {
|
||||
Yes,
|
||||
No,
|
||||
}
|
||||
|
||||
fn sort_and_truncate_possibilities(
|
||||
sess: &Session,
|
||||
mut possibilities: Vec<Symbol>,
|
||||
filter_well_known_names: FilterWellKnownNames,
|
||||
) -> (Vec<Symbol>, usize) {
|
||||
let possibilities_len = possibilities.len();
|
||||
|
||||
let n_possibilities = if sess.opts.unstable_opts.check_cfg_all_expected {
|
||||
possibilities.len()
|
||||
} else {
|
||||
match filter_well_known_names {
|
||||
FilterWellKnownNames::Yes => {
|
||||
possibilities.retain(|cfg_name| {
|
||||
!sess.psess.check_config.well_known_names.contains(cfg_name)
|
||||
});
|
||||
}
|
||||
FilterWellKnownNames::No => {}
|
||||
};
|
||||
std::cmp::min(possibilities.len(), MAX_CHECK_CFG_NAMES_OR_VALUES)
|
||||
};
|
||||
|
||||
possibilities.sort_by(|s1, s2| s1.as_str().cmp(s2.as_str()));
|
||||
|
||||
let and_more = possibilities.len().saturating_sub(n_possibilities);
|
||||
let and_more = possibilities_len.saturating_sub(n_possibilities);
|
||||
possibilities.truncate(n_possibilities);
|
||||
(possibilities, and_more)
|
||||
}
|
||||
|
@ -198,8 +214,10 @@ pub(super) fn unexpected_cfg_name(
|
|||
} else {
|
||||
vec![]
|
||||
};
|
||||
|
||||
let (possibilities, and_more) =
|
||||
sort_and_truncate_possibilities(sess, possibilities, FilterWellKnownNames::Yes);
|
||||
let expected_names = if !possibilities.is_empty() {
|
||||
let (possibilities, and_more) = sort_and_truncate_possibilities(sess, possibilities);
|
||||
let possibilities: Vec<_> =
|
||||
possibilities.into_iter().map(|s| Ident::new(s, name_span)).collect();
|
||||
Some(lints::unexpected_cfg_name::ExpectedNames {
|
||||
|
@ -269,8 +287,11 @@ pub(super) fn unexpected_cfg_value(
|
|||
// for names as the possibilities could be very long
|
||||
let code_sugg = if !possibilities.is_empty() {
|
||||
let expected_values = {
|
||||
let (possibilities, and_more) =
|
||||
sort_and_truncate_possibilities(sess, possibilities.clone());
|
||||
let (possibilities, and_more) = sort_and_truncate_possibilities(
|
||||
sess,
|
||||
possibilities.clone(),
|
||||
FilterWellKnownNames::No,
|
||||
);
|
||||
lints::unexpected_cfg_value::ExpectedValues {
|
||||
name,
|
||||
have_none_possibility,
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
//@ check-pass
|
||||
//@ no-auto-check-cfg
|
||||
//@ compile-flags: --check-cfg=cfg() --cfg=unknown_but_active_cfg
|
||||
//@ normalize-stderr: "expected names are: .*" -> "..."
|
||||
|
||||
#[allow(unexpected_cfgs)]
|
||||
#[cfg(FALSE)]
|
||||
|
|
|
@ -1,16 +1,15 @@
|
|||
warning: unexpected `cfg` condition name: `FALSE`
|
||||
--> $DIR/allow-same-level.rs:16:7
|
||||
--> $DIR/allow-same-level.rs:15:7
|
||||
|
|
||||
LL | #[cfg(FALSE)]
|
||||
| ^^^^^
|
||||
|
|
||||
= help: ...
|
||||
= help: to expect this configuration use `--check-cfg=cfg(FALSE)`
|
||||
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration
|
||||
= note: `#[warn(unexpected_cfgs)]` on by default
|
||||
|
||||
warning: unexpected `cfg` condition name: `unknown_but_active_cfg`
|
||||
--> $DIR/allow-same-level.rs:21:7
|
||||
--> $DIR/allow-same-level.rs:20:7
|
||||
|
|
||||
LL | #[cfg(unknown_but_active_cfg)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
|
@ -4,7 +4,7 @@ warning: unexpected `cfg` condition name: `has_foo`
|
|||
LL | #[cfg(has_foo)]
|
||||
| ^^^^^^^
|
||||
|
|
||||
= help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `fmt_debug`, `has_bar`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `ub_checks`, `unix`, and `windows`
|
||||
= help: expected names are: `has_bar` and 30 more
|
||||
= help: consider using a Cargo feature instead
|
||||
= help: or consider adding in `Cargo.toml` the `check-cfg` lint config for the lint:
|
||||
[lints.rust]
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
warning: unexpected `cfg` condition value: `serde`
|
||||
--> $DIR/cargo-feature.rs:14:7
|
||||
--> $DIR/cargo-feature.rs:15:7
|
||||
|
|
||||
LL | #[cfg(feature = "serde")]
|
||||
| ^^^^^^^^^^^^^^^^^ help: remove the condition
|
||||
|
@ -10,7 +10,7 @@ LL | #[cfg(feature = "serde")]
|
|||
= note: `#[warn(unexpected_cfgs)]` on by default
|
||||
|
||||
warning: unexpected `cfg` condition value: (none)
|
||||
--> $DIR/cargo-feature.rs:18:7
|
||||
--> $DIR/cargo-feature.rs:19:7
|
||||
|
|
||||
LL | #[cfg(feature)]
|
||||
| ^^^^^^^ help: remove the condition
|
||||
|
@ -20,12 +20,12 @@ LL | #[cfg(feature)]
|
|||
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration
|
||||
|
||||
warning: unexpected `cfg` condition name: `tokio_unstable`
|
||||
--> $DIR/cargo-feature.rs:22:7
|
||||
--> $DIR/cargo-feature.rs:23:7
|
||||
|
|
||||
LL | #[cfg(tokio_unstable)]
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `feature`, `fmt_debug`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `ub_checks`, `unix`, and `windows`
|
||||
= help: expected names are: `docsrs`, `feature`, and `test` and 30 more
|
||||
= help: consider using a Cargo feature instead
|
||||
= help: or consider adding in `Cargo.toml` the `check-cfg` lint config for the lint:
|
||||
[lints.rust]
|
||||
|
@ -34,7 +34,7 @@ LL | #[cfg(tokio_unstable)]
|
|||
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration
|
||||
|
||||
warning: unexpected `cfg` condition name: `CONFIG_NVME`
|
||||
--> $DIR/cargo-feature.rs:26:7
|
||||
--> $DIR/cargo-feature.rs:27:7
|
||||
|
|
||||
LL | #[cfg(CONFIG_NVME = "m")]
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
//@ no-auto-check-cfg
|
||||
//@ revisions: some none
|
||||
//@ rustc-env:CARGO_CRATE_NAME=foo
|
||||
//@ compile-flags: --check-cfg=cfg(docsrs,test)
|
||||
//@ [none]compile-flags: --check-cfg=cfg(feature,values())
|
||||
//@ [some]compile-flags: --check-cfg=cfg(feature,values("bitcode"))
|
||||
//@ [some]compile-flags: --check-cfg=cfg(CONFIG_NVME,values("y"))
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
warning: unexpected `cfg` condition value: `serde`
|
||||
--> $DIR/cargo-feature.rs:14:7
|
||||
--> $DIR/cargo-feature.rs:15:7
|
||||
|
|
||||
LL | #[cfg(feature = "serde")]
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
@ -10,7 +10,7 @@ LL | #[cfg(feature = "serde")]
|
|||
= note: `#[warn(unexpected_cfgs)]` on by default
|
||||
|
||||
warning: unexpected `cfg` condition value: (none)
|
||||
--> $DIR/cargo-feature.rs:18:7
|
||||
--> $DIR/cargo-feature.rs:19:7
|
||||
|
|
||||
LL | #[cfg(feature)]
|
||||
| ^^^^^^^- help: specify a config value: `= "bitcode"`
|
||||
|
@ -20,12 +20,12 @@ LL | #[cfg(feature)]
|
|||
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration
|
||||
|
||||
warning: unexpected `cfg` condition name: `tokio_unstable`
|
||||
--> $DIR/cargo-feature.rs:22:7
|
||||
--> $DIR/cargo-feature.rs:23:7
|
||||
|
|
||||
LL | #[cfg(tokio_unstable)]
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: expected names are: `CONFIG_NVME`, `clippy`, `debug_assertions`, `doc`, `doctest`, `feature`, `fmt_debug`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `ub_checks`, `unix`, and `windows`
|
||||
= help: expected names are: `CONFIG_NVME`, `docsrs`, `feature`, and `test` and 30 more
|
||||
= help: consider using a Cargo feature instead
|
||||
= help: or consider adding in `Cargo.toml` the `check-cfg` lint config for the lint:
|
||||
[lints.rust]
|
||||
|
@ -34,7 +34,7 @@ LL | #[cfg(tokio_unstable)]
|
|||
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration
|
||||
|
||||
warning: unexpected `cfg` condition value: `m`
|
||||
--> $DIR/cargo-feature.rs:26:7
|
||||
--> $DIR/cargo-feature.rs:27:7
|
||||
|
|
||||
LL | #[cfg(CONFIG_NVME = "m")]
|
||||
| ^^^^^^^^^^^^^^---
|
||||
|
|
|
@ -4,7 +4,7 @@ warning: unexpected `cfg` condition name: `value`
|
|||
LL | #[cfg(value)]
|
||||
| ^^^^^
|
||||
|
|
||||
= help: expected names are: `bar`, `bee`, `clippy`, `cow`, `debug_assertions`, `doc`, `doctest`, `fmt_debug`, `foo`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `ub_checks`, `unix`, and `windows`
|
||||
= help: expected names are: `bar`, `bee`, `cow`, and `foo` and 30 more
|
||||
= help: to expect this configuration use `--check-cfg=cfg(value)`
|
||||
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration
|
||||
= note: `#[warn(unexpected_cfgs)]` on by default
|
||||
|
|
|
@ -4,7 +4,7 @@ warning: unexpected `cfg` condition name: `my_value`
|
|||
LL | #[cfg(my_value)]
|
||||
| ^^^^^^^^
|
||||
|
|
||||
= help: expected names are: `bar`, `clippy`, `debug_assertions`, `doc`, `doctest`, `fmt_debug`, `foo`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `ub_checks`, `unix`, and `windows`
|
||||
= help: expected names are: `bar` and `foo` and 30 more
|
||||
= help: to expect this configuration use `--check-cfg=cfg(my_value)`
|
||||
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration
|
||||
= note: `#[warn(unexpected_cfgs)]` on by default
|
||||
|
|
|
@ -4,7 +4,6 @@ warning: unexpected `cfg` condition name: `linux`
|
|||
LL | #[cfg(linux)]
|
||||
| ^^^^^ help: found config with similar value: `target_os = "linux"`
|
||||
|
|
||||
= help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `fmt_debug`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `ub_checks`, `unix`, and `windows`
|
||||
= help: to expect this configuration use `--check-cfg=cfg(linux)`
|
||||
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration
|
||||
= note: `#[warn(unexpected_cfgs)]` on by default
|
||||
|
|
|
@ -4,7 +4,6 @@ warning: unexpected `cfg` condition name: `target_architecture`
|
|||
LL | #[cfg(target(os = "linux", architecture = "arm"))]
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `fmt_debug`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `ub_checks`, `unix`, and `windows`
|
||||
= help: to expect this configuration use `--check-cfg=cfg(target_architecture, values("arm"))`
|
||||
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration
|
||||
= note: `#[warn(unexpected_cfgs)]` on by default
|
||||
|
|
|
@ -4,7 +4,6 @@ warning: unexpected `cfg` condition name: `unknown_key`
|
|||
LL | #[cfg(unknown_key = "value")]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `fmt_debug`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `ub_checks`, `unix`, and `windows`
|
||||
= help: to expect this configuration use `--check-cfg=cfg(unknown_key, values("value"))`
|
||||
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration
|
||||
= note: `#[warn(unexpected_cfgs)]` on by default
|
||||
|
|
|
@ -4,7 +4,7 @@ warning: unexpected `cfg` condition name: `unknown_key`
|
|||
LL | #[cfg(unknown_key = "value")]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `feature`, `fmt_debug`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `ub_checks`, `unix`, and `windows`
|
||||
= help: expected names are: `feature` and 30 more
|
||||
= help: to expect this configuration use `--check-cfg=cfg(unknown_key, values("value"))`
|
||||
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration
|
||||
= note: `#[warn(unexpected_cfgs)]` on by default
|
||||
|
|
|
@ -4,7 +4,7 @@ warning: unexpected `cfg` condition name: `unknown_key`
|
|||
LL | #[cfg(unknown_key = "value")]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `feature`, `fmt_debug`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `ub_checks`, `unix`, and `windows`
|
||||
= help: expected names are: `feature` and 30 more
|
||||
= help: to expect this configuration use `--check-cfg=cfg(unknown_key, values("value"))`
|
||||
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration
|
||||
= note: `#[warn(unexpected_cfgs)]` on by default
|
||||
|
|
|
@ -4,7 +4,6 @@ warning: unexpected `cfg` condition name: `unknown_key`
|
|||
LL | #[cfg(unknown_key = "value")]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `fmt_debug`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `ub_checks`, `unix`, and `windows`
|
||||
= help: to expect this configuration use `--check-cfg=cfg(unknown_key, values("value"))`
|
||||
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration
|
||||
= note: `#[warn(unexpected_cfgs)]` on by default
|
||||
|
|
|
@ -44,7 +44,7 @@ warning: unexpected `cfg` condition name: `uu`
|
|||
LL | #[cfg_attr(uu, unix)]
|
||||
| ^^
|
||||
|
|
||||
= help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `feature`, `fmt_debug`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `ub_checks`, `unix`, and `windows`
|
||||
= help: expected names are: `feature` and 30 more
|
||||
= help: to expect this configuration use `--check-cfg=cfg(uu)`
|
||||
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ warning: unexpected `cfg` condition name: `r#false`
|
|||
LL | #[cfg(r#false)]
|
||||
| ^^^^^^^
|
||||
|
|
||||
= help: expected names are: `async`, `clippy`, `debug_assertions`, `doc`, `doctest`, `edition2015`, `edition2021`, `fmt_debug`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `r#true`, `ub_checks`, `unix`, and `windows`
|
||||
= help: expected names are: `async`, `edition2015`, `edition2021`, and `r#true` and 30 more
|
||||
= help: to expect this configuration use `--check-cfg=cfg(r#false)`
|
||||
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ warning: unexpected `cfg` condition name: `r#false`
|
|||
LL | #[cfg(r#false)]
|
||||
| ^^^^^^^
|
||||
|
|
||||
= help: expected names are: `r#async`, `clippy`, `debug_assertions`, `doc`, `doctest`, `edition2015`, `edition2021`, `fmt_debug`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `r#true`, `ub_checks`, `unix`, and `windows`
|
||||
= help: expected names are: `r#async`, `edition2015`, `edition2021`, and `r#true` and 30 more
|
||||
= help: to expect this configuration use `--check-cfg=cfg(r#false)`
|
||||
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ warning: unexpected `cfg` condition name: `my_lib_cfg`
|
|||
LL | cfg_macro::my_lib_macro!();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `feature`, `fmt_debug`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `ub_checks`, `unix`, and `windows`
|
||||
= help: expected names are: `feature` and 30 more
|
||||
= note: using a cfg inside a macro will use the cfgs from the destination crate and not the ones from the defining crate
|
||||
= help: try referring to `cfg_macro::my_lib_macro` crate for guidance on how handle this unexpected cfg
|
||||
= help: the macro `cfg_macro::my_lib_macro` may come from an old version of the `cfg_macro` crate, try updating your dependency with `cargo update -p cfg_macro`
|
||||
|
|
|
@ -4,7 +4,7 @@ warning: unexpected `cfg` condition name: `my_lib_cfg`
|
|||
LL | cfg_macro::my_lib_macro!();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `feature`, `fmt_debug`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `ub_checks`, `unix`, and `windows`
|
||||
= help: expected names are: `feature` and 30 more
|
||||
= note: using a cfg inside a macro will use the cfgs from the destination crate and not the ones from the defining crate
|
||||
= help: try referring to `cfg_macro::my_lib_macro` crate for guidance on how handle this unexpected cfg
|
||||
= help: to expect this configuration use `--check-cfg=cfg(my_lib_cfg)`
|
||||
|
|
|
@ -4,7 +4,6 @@ warning: unexpected `cfg` condition name: `crossbeam_loom`
|
|||
LL | #[cfg(crossbeam_loom)]
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `fmt_debug`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `ub_checks`, `unix`, and `windows`
|
||||
= help: to expect this configuration use `--check-cfg=cfg(crossbeam_loom)`
|
||||
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration
|
||||
= note: `#[warn(unexpected_cfgs)]` on by default
|
||||
|
|
|
@ -14,7 +14,6 @@ warning: unexpected `cfg` condition name: `test`
|
|||
LL | #[cfg(test)]
|
||||
| ^^^^
|
||||
|
|
||||
= help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `fmt_debug`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `ub_checks`, `unix`, and `windows`
|
||||
= help: to expect this configuration use `--check-cfg=cfg(test)`
|
||||
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration
|
||||
|
||||
|
|
|
@ -2,7 +2,12 @@
|
|||
//
|
||||
//@ check-pass
|
||||
//@ no-auto-check-cfg
|
||||
//@ compile-flags: --check-cfg=cfg()
|
||||
//@ compile-flags: --check-cfg=cfg() -Zcheck-cfg-all-expected
|
||||
//@ normalize-stderr: "`, `" -> "`\n`"
|
||||
|
||||
#[cfg(list_all_well_known_cfgs)]
|
||||
//~^ WARNING unexpected `cfg` condition name
|
||||
fn in_diagnostics() {}
|
||||
|
||||
#[cfg(target_oz = "linux")]
|
||||
//~^ WARNING unexpected `cfg` condition name
|
||||
|
|
|
@ -1,29 +1,66 @@
|
|||
warning: unexpected `cfg` condition name: `list_all_well_known_cfgs`
|
||||
--> $DIR/well-known-names.rs:8:7
|
||||
|
|
||||
LL | #[cfg(list_all_well_known_cfgs)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: expected names are: `clippy`
|
||||
`debug_assertions`
|
||||
`doc`
|
||||
`doctest`
|
||||
`fmt_debug`
|
||||
`miri`
|
||||
`overflow_checks`
|
||||
`panic`
|
||||
`proc_macro`
|
||||
`relocation_model`
|
||||
`rustfmt`
|
||||
`sanitize`
|
||||
`sanitizer_cfi_generalize_pointers`
|
||||
`sanitizer_cfi_normalize_integers`
|
||||
`target_abi`
|
||||
`target_arch`
|
||||
`target_endian`
|
||||
`target_env`
|
||||
`target_family`
|
||||
`target_feature`
|
||||
`target_has_atomic`
|
||||
`target_has_atomic_equal_alignment`
|
||||
`target_has_atomic_load_store`
|
||||
`target_os`
|
||||
`target_pointer_width`
|
||||
`target_thread_local`
|
||||
`target_vendor`
|
||||
`ub_checks`
|
||||
`unix`, and `windows`
|
||||
= help: to expect this configuration use `--check-cfg=cfg(list_all_well_known_cfgs)`
|
||||
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration
|
||||
= note: `#[warn(unexpected_cfgs)]` on by default
|
||||
|
||||
warning: unexpected `cfg` condition name: `target_oz`
|
||||
--> $DIR/well-known-names.rs:7:7
|
||||
--> $DIR/well-known-names.rs:12:7
|
||||
|
|
||||
LL | #[cfg(target_oz = "linux")]
|
||||
| ^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: to expect this configuration use `--check-cfg=cfg(target_oz, values("linux"))`
|
||||
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration
|
||||
= note: `#[warn(unexpected_cfgs)]` on by default
|
||||
help: there is a config with a similar name and value
|
||||
|
|
||||
LL | #[cfg(target_os = "linux")]
|
||||
| ~~~~~~~~~
|
||||
|
||||
warning: unexpected `cfg` condition name: `features`
|
||||
--> $DIR/well-known-names.rs:14:7
|
||||
--> $DIR/well-known-names.rs:19:7
|
||||
|
|
||||
LL | #[cfg(features = "foo")]
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `fmt_debug`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `ub_checks`, `unix`, and `windows`
|
||||
= help: to expect this configuration use `--check-cfg=cfg(features, values("foo"))`
|
||||
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration
|
||||
|
||||
warning: unexpected `cfg` condition name: `feature`
|
||||
--> $DIR/well-known-names.rs:18:7
|
||||
--> $DIR/well-known-names.rs:23:7
|
||||
|
|
||||
LL | #[cfg(feature = "foo")]
|
||||
| ^^^^^^^^^^^^^^^
|
||||
|
@ -32,7 +69,7 @@ LL | #[cfg(feature = "foo")]
|
|||
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration
|
||||
|
||||
warning: unexpected `cfg` condition name: `uniw`
|
||||
--> $DIR/well-known-names.rs:22:7
|
||||
--> $DIR/well-known-names.rs:27:7
|
||||
|
|
||||
LL | #[cfg(uniw)]
|
||||
| ^^^^ help: there is a config with a similar name: `unix`
|
||||
|
@ -40,5 +77,5 @@ LL | #[cfg(uniw)]
|
|||
= help: to expect this configuration use `--check-cfg=cfg(uniw)`
|
||||
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration
|
||||
|
||||
warning: 4 warnings emitted
|
||||
warning: 5 warnings emitted
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue