Skip to content
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

Resolve unexpected_cfgs warning #1344

Merged
merged 1 commit into from
May 7, 2024
Merged

Resolve unexpected_cfgs warning #1344

merged 1 commit into from
May 7, 2024

Conversation

dtolnay
Copy link
Owner

@dtolnay dtolnay commented May 7, 2024

    warning: unexpected `cfg` condition value: `experimental-enum-variants-from-header`
       --> gen/build/src/gen/write.rs:333:15
        |
    333 |         #[cfg(feature = "experimental-enum-variants-from-header")]
        |               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        |
        = note: expected values for `feature` are: `experimental-async-fn`, `parallel`
        = help: consider adding `experimental-enum-variants-from-header` as a feature in `Cargo.toml`
        = note: see <https://doc.rust-lang.org/nightly/cargo/reference/build-scripts.html#rustc-check-cfg> for more information about checking conditional configuration
        = note: `#[warn(unexpected_cfgs)]` on by default

    warning: unexpected `cfg` condition value: `experimental-enum-variants-from-header`
       --> gen/build/src/gen/write.rs:393:15
        |
    393 |         #[cfg(feature = "experimental-enum-variants-from-header")]
        |               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        |
        = note: expected values for `feature` are: `experimental-async-fn`, `parallel`
        = help: consider adding `experimental-enum-variants-from-header` as a feature in `Cargo.toml`
        = note: see <https://doc.rust-lang.org/nightly/cargo/reference/build-scripts.html#rustc-check-cfg> for more information about checking conditional configuration

    warning: unexpected `cfg` condition value: `experimental-enum-variants-from-header`
       --> gen/build/src/gen/write.rs:415:15
        |
    415 |         #[cfg(feature = "experimental-enum-variants-from-header")]
        |               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        |
        = note: expected values for `feature` are: `experimental-async-fn`, `parallel`
        = help: consider adding `experimental-enum-variants-from-header` as a feature in `Cargo.toml`
        = note: see <https://doc.rust-lang.org/nightly/cargo/reference/build-scripts.html#rustc-check-cfg> for more information about checking conditional configuration

    warning: unexpected `cfg` condition value: `experimental-enum-variants-from-header`
       --> gen/build/src/syntax/attrs.rs:147:21
        |
    147 |             && cfg!(feature = "experimental-enum-variants-from-header")
        |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        |
        = note: expected values for `feature` are: `experimental-async-fn`, `parallel`
        = help: consider adding `experimental-enum-variants-from-header` as a feature in `Cargo.toml`
        = note: see <https://doc.rust-lang.org/nightly/cargo/reference/build-scripts.html#rustc-check-cfg> for more information about checking conditional configuration

    warning: unexpected `cfg` condition value: `experimental-enum-variants-from-header`
       --> gen/build/src/syntax/discriminant.rs:182:11
        |
    182 |     #[cfg(feature = "experimental-enum-variants-from-header")]
        |           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        |
        = note: expected values for `feature` are: `experimental-async-fn`, `parallel`
        = help: consider adding `experimental-enum-variants-from-header` as a feature in `Cargo.toml`
        = note: see <https://doc.rust-lang.org/nightly/cargo/reference/build-scripts.html#rustc-check-cfg> for more information about checking conditional configuration

    warning: unexpected `cfg` condition value: `experimental-enum-variants-from-header`
       --> gen/build/src/syntax/tokens.rs:296:19
        |
    296 |             #[cfg(feature = "experimental-enum-variants-from-header")]
        |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        |
        = note: expected values for `feature` are: `experimental-async-fn`, `parallel`
        = help: consider adding `experimental-enum-variants-from-header` as a feature in `Cargo.toml`
        = note: see <https://doc.rust-lang.org/nightly/cargo/reference/build-scripts.html#rustc-check-cfg> for more information about checking conditional configuration

    warning: unexpected `cfg` condition value: `experimental-enum-variants-from-header`
      --> gen/build/src/syntax/types.rs:95:31
       |
    95 |                         #[cfg(feature = "experimental-enum-variants-from-header")]
       |                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
       |
       = note: expected values for `feature` are: `experimental-async-fn`, `parallel`
       = help: consider adding `experimental-enum-variants-from-header` as a feature in `Cargo.toml`
       = note: see <https://doc.rust-lang.org/nightly/cargo/reference/build-scripts.html#rustc-check-cfg> for more information about checking conditional configuration

    warning: unexpected `cfg` condition value: `experimental-enum-variants-from-header`
       --> gen/build/src/syntax/mod.rs:146:11
        |
    146 |     #[cfg(feature = "experimental-enum-variants-from-header")]
        |           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        |
        = note: expected values for `feature` are: `experimental-async-fn`, `parallel`
        = help: consider adding `experimental-enum-variants-from-header` as a feature in `Cargo.toml`
        = note: see <https://doc.rust-lang.org/nightly/cargo/reference/build-scripts.html#rustc-check-cfg> for more information about checking conditional configuration

    warning: unexpected `cfg` condition value: `experimental-enum-variants-from-header`
       --> gen/lib/src/gen/write.rs:333:15
        |
    333 |         #[cfg(feature = "experimental-enum-variants-from-header")]
        |               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove the condition
        |
        = note: no expected values for `feature`
        = help: consider adding `experimental-enum-variants-from-header` as a feature in `Cargo.toml`
        = note: see <https://doc.rust-lang.org/nightly/cargo/reference/build-scripts.html#rustc-check-cfg> for more information about checking conditional configuration
        = note: `#[warn(unexpected_cfgs)]` on by default

    warning: unexpected `cfg` condition value: `experimental-enum-variants-from-header`
       --> gen/lib/src/gen/write.rs:393:15
        |
    393 |         #[cfg(feature = "experimental-enum-variants-from-header")]
        |               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove the condition
        |
        = note: no expected values for `feature`
        = help: consider adding `experimental-enum-variants-from-header` as a feature in `Cargo.toml`
        = note: see <https://doc.rust-lang.org/nightly/cargo/reference/build-scripts.html#rustc-check-cfg> for more information about checking conditional configuration

    warning: unexpected `cfg` condition value: `experimental-enum-variants-from-header`
       --> gen/lib/src/gen/write.rs:415:15
        |
    415 |         #[cfg(feature = "experimental-enum-variants-from-header")]
        |               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove the condition
        |
        = note: no expected values for `feature`
        = help: consider adding `experimental-enum-variants-from-header` as a feature in `Cargo.toml`
        = note: see <https://doc.rust-lang.org/nightly/cargo/reference/build-scripts.html#rustc-check-cfg> for more information about checking conditional configuration

    warning: unexpected `cfg` condition value: `experimental-enum-variants-from-header`
       --> gen/lib/src/syntax/attrs.rs:147:21
        |
    147 |             && cfg!(feature = "experimental-enum-variants-from-header")
        |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove the condition
        |
        = note: no expected values for `feature`
        = help: consider adding `experimental-enum-variants-from-header` as a feature in `Cargo.toml`
        = note: see <https://doc.rust-lang.org/nightly/cargo/reference/build-scripts.html#rustc-check-cfg> for more information about checking conditional configuration

    warning: unexpected `cfg` condition value: `experimental-enum-variants-from-header`
       --> gen/lib/src/syntax/discriminant.rs:182:11
        |
    182 |     #[cfg(feature = "experimental-enum-variants-from-header")]
        |           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove the condition
        |
        = note: no expected values for `feature`
        = help: consider adding `experimental-enum-variants-from-header` as a feature in `Cargo.toml`
        = note: see <https://doc.rust-lang.org/nightly/cargo/reference/build-scripts.html#rustc-check-cfg> for more information about checking conditional configuration

    warning: unexpected `cfg` condition value: `experimental-async-fn`
       --> gen/lib/src/syntax/parse.rs:565:52
        |
    565 |     if foreign_fn.sig.asyncness.is_some() && !cfg!(feature = "experimental-async-fn") {
        |                                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove the condition
        |
        = note: no expected values for `feature`
        = help: consider adding `experimental-async-fn` as a feature in `Cargo.toml`
        = note: see <https://doc.rust-lang.org/nightly/cargo/reference/build-scripts.html#rustc-check-cfg> for more information about checking conditional configuration

    warning: unexpected `cfg` condition value: `experimental-enum-variants-from-header`
       --> gen/lib/src/syntax/tokens.rs:296:19
        |
    296 |             #[cfg(feature = "experimental-enum-variants-from-header")]
        |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove the condition
        |
        = note: no expected values for `feature`
        = help: consider adding `experimental-enum-variants-from-header` as a feature in `Cargo.toml`
        = note: see <https://doc.rust-lang.org/nightly/cargo/reference/build-scripts.html#rustc-check-cfg> for more information about checking conditional configuration

    warning: unexpected `cfg` condition value: `experimental-enum-variants-from-header`
      --> gen/lib/src/syntax/types.rs:95:31
       |
    95 |                         #[cfg(feature = "experimental-enum-variants-from-header")]
       |                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove the condition
       |
       = note: no expected values for `feature`
       = help: consider adding `experimental-enum-variants-from-header` as a feature in `Cargo.toml`
       = note: see <https://doc.rust-lang.org/nightly/cargo/reference/build-scripts.html#rustc-check-cfg> for more information about checking conditional configuration

    warning: unexpected `cfg` condition value: `experimental-enum-variants-from-header`
       --> gen/lib/src/syntax/mod.rs:146:11
        |
    146 |     #[cfg(feature = "experimental-enum-variants-from-header")]
        |           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove the condition
        |
        = note: no expected values for `feature`
        = help: consider adding `experimental-enum-variants-from-header` as a feature in `Cargo.toml`
        = note: see <https://doc.rust-lang.org/nightly/cargo/reference/build-scripts.html#rustc-check-cfg> for more information about checking conditional configuration

    warning: unexpected `cfg` condition value: `experimental-enum-variants-from-header`
       --> gen/cmd/src/gen/write.rs:333:15
        |
    333 |         #[cfg(feature = "experimental-enum-variants-from-header")]
        |               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        |
        = note: expected values for `feature` are: `experimental-async-fn`
        = help: consider adding `experimental-enum-variants-from-header` as a feature in `Cargo.toml`
        = note: see <https://doc.rust-lang.org/nightly/cargo/reference/build-scripts.html#rustc-check-cfg> for more information about checking conditional configuration
        = note: `#[warn(unexpected_cfgs)]` on by default

    warning: unexpected `cfg` condition value: `experimental-enum-variants-from-header`
       --> gen/cmd/src/gen/write.rs:393:15
        |
    393 |         #[cfg(feature = "experimental-enum-variants-from-header")]
        |               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        |
        = note: expected values for `feature` are: `experimental-async-fn`
        = help: consider adding `experimental-enum-variants-from-header` as a feature in `Cargo.toml`
        = note: see <https://doc.rust-lang.org/nightly/cargo/reference/build-scripts.html#rustc-check-cfg> for more information about checking conditional configuration

    warning: unexpected `cfg` condition value: `experimental-enum-variants-from-header`
       --> gen/cmd/src/gen/write.rs:415:15
        |
    415 |         #[cfg(feature = "experimental-enum-variants-from-header")]
        |               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        |
        = note: expected values for `feature` are: `experimental-async-fn`
        = help: consider adding `experimental-enum-variants-from-header` as a feature in `Cargo.toml`
        = note: see <https://doc.rust-lang.org/nightly/cargo/reference/build-scripts.html#rustc-check-cfg> for more information about checking conditional configuration

    warning: unexpected `cfg` condition value: `experimental-enum-variants-from-header`
       --> gen/cmd/src/syntax/attrs.rs:147:21
        |
    147 |             && cfg!(feature = "experimental-enum-variants-from-header")
        |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        |
        = note: expected values for `feature` are: `experimental-async-fn`
        = help: consider adding `experimental-enum-variants-from-header` as a feature in `Cargo.toml`
        = note: see <https://doc.rust-lang.org/nightly/cargo/reference/build-scripts.html#rustc-check-cfg> for more information about checking conditional configuration

    warning: unexpected `cfg` condition value: `experimental-enum-variants-from-header`
       --> gen/cmd/src/syntax/discriminant.rs:182:11
        |
    182 |     #[cfg(feature = "experimental-enum-variants-from-header")]
        |           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        |
        = note: expected values for `feature` are: `experimental-async-fn`
        = help: consider adding `experimental-enum-variants-from-header` as a feature in `Cargo.toml`
        = note: see <https://doc.rust-lang.org/nightly/cargo/reference/build-scripts.html#rustc-check-cfg> for more information about checking conditional configuration

    warning: unexpected `cfg` condition value: `experimental-enum-variants-from-header`
       --> gen/cmd/src/syntax/tokens.rs:296:19
        |
    296 |             #[cfg(feature = "experimental-enum-variants-from-header")]
        |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        |
        = note: expected values for `feature` are: `experimental-async-fn`
        = help: consider adding `experimental-enum-variants-from-header` as a feature in `Cargo.toml`
        = note: see <https://doc.rust-lang.org/nightly/cargo/reference/build-scripts.html#rustc-check-cfg> for more information about checking conditional configuration

    warning: unexpected `cfg` condition value: `experimental-enum-variants-from-header`
      --> gen/cmd/src/syntax/types.rs:95:31
       |
    95 |                         #[cfg(feature = "experimental-enum-variants-from-header")]
       |                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
       |
       = note: expected values for `feature` are: `experimental-async-fn`
       = help: consider adding `experimental-enum-variants-from-header` as a feature in `Cargo.toml`
       = note: see <https://doc.rust-lang.org/nightly/cargo/reference/build-scripts.html#rustc-check-cfg> for more information about checking conditional configuration

    warning: unexpected `cfg` condition value: `experimental-enum-variants-from-header`
       --> gen/cmd/src/syntax/mod.rs:146:11
        |
    146 |     #[cfg(feature = "experimental-enum-variants-from-header")]
        |           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        |
        = note: expected values for `feature` are: `experimental-async-fn`
        = help: consider adding `experimental-enum-variants-from-header` as a feature in `Cargo.toml`
        = note: see <https://doc.rust-lang.org/nightly/cargo/reference/build-scripts.html#rustc-check-cfg> for more information about checking conditional configuration

    warning: unexpected `cfg` condition name: `trybuild`
     --> tests/ffi/build.rs:4:13
      |
    4 |     if cfg!(trybuild) {
      |             ^^^^^^^^
      |
      = help: expected names are: `clippy`, `debug_assertions`, `doc`, `docsrs`, `doctest`, `feature`, `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`, `test`, `ub_checks`, `unix`, `windows`
      = help: consider using a Cargo feature instead or adding `println!("cargo::rustc-check-cfg=cfg(trybuild)");` to the top of the `build.rs`
      = note: see <https://doc.rust-lang.org/nightly/cargo/reference/build-scripts.html#rustc-check-cfg> for more information about checking conditional configuration
      = note: `#[warn(unexpected_cfgs)]` on by default

    warning: unexpected `cfg` condition name: `deny_warnings`
      --> tests/ffi/build.rs:13:37
       |
    13 |     build.warnings_into_errors(cfg!(deny_warnings));
       |                                     ^^^^^^^^^^^^^
       |
       = help: consider using a Cargo feature instead or adding `println!("cargo::rustc-check-cfg=cfg(deny_warnings)");` to the top of the `build.rs`
       = note: see <https://doc.rust-lang.org/nightly/cargo/reference/build-scripts.html#rustc-check-cfg> for more information about checking conditional configuration

    warning: unexpected `cfg` condition name: `deny_warnings`
      --> build.rs:14:36
       |
    14 |         .warnings_into_errors(cfg!(deny_warnings))
       |                                    ^^^^^^^^^^^^^
       |
       = help: expected names are: `clippy`, `debug_assertions`, `doc`, `docsrs`, `doctest`, `feature`, `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`, `test`, `ub_checks`, `unix`, `windows`
       = help: consider using a Cargo feature instead or adding `println!("cargo::rustc-check-cfg=cfg(deny_warnings)");` to the top of the `build.rs`
       = note: see <https://doc.rust-lang.org/nightly/cargo/reference/build-scripts.html#rustc-check-cfg> for more information about checking conditional configuration
       = note: `#[warn(unexpected_cfgs)]` on by default

    warning: unexpected `cfg` condition name: `doc_cfg`
       --> src/lib.rs:368:13
        |
    368 | #![cfg_attr(doc_cfg, feature(doc_cfg))]
        |             ^^^^^^^
        |
        = help: expected names are: `clippy`, `debug_assertions`, `doc`, `docsrs`, `doctest`, `feature`, `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`, `test`, `ub_checks`, `unix`, `windows`
        = help: consider using a Cargo feature instead or adding `println!("cargo::rustc-check-cfg=cfg(doc_cfg)");` to the top of the `build.rs`
        = note: see <https://doc.rust-lang.org/nightly/cargo/reference/build-scripts.html#rustc-check-cfg> for more information about checking conditional configuration
        = note: `#[warn(unexpected_cfgs)]` on by default

    warning: unexpected `cfg` condition name: `built_with_cargo`
       --> src/lib.rs:409:7
        |
    409 | #[cfg(built_with_cargo)]
        |       ^^^^^^^^^^^^^^^^
        |
        = help: consider using a Cargo feature instead or adding `println!("cargo::rustc-check-cfg=cfg(built_with_cargo)");` to the top of the `build.rs`
        = note: see <https://doc.rust-lang.org/nightly/cargo/reference/build-scripts.html#rustc-check-cfg> for more information about checking conditional configuration

    warning: unexpected `cfg` condition name: `cxx_experimental_no_alloc`
       --> src/lib.rs:433:34
        |
    433 | #[cfg(not(any(feature = "alloc", cxx_experimental_no_alloc)))]
        |                                  ^^^^^^^^^^^^^^^^^^^^^^^^^
        |
        = help: consider using a Cargo feature instead or adding `println!("cargo::rustc-check-cfg=cfg(cxx_experimental_no_alloc)");` to the top of the `build.rs`
        = note: see <https://doc.rust-lang.org/nightly/cargo/reference/build-scripts.html#rustc-check-cfg> for more information about checking conditional configuration

    warning: unexpected `cfg` condition name: `compile_error_if_alloc`
       --> src/lib.rs:438:11
        |
    438 | #[cfg(all(compile_error_if_alloc, feature = "alloc"))]
        |           ^^^^^^^^^^^^^^^^^^^^^^
        |
        = help: consider using a Cargo feature instead or adding `println!("cargo::rustc-check-cfg=cfg(compile_error_if_alloc)");` to the top of the `build.rs`
        = note: see <https://doc.rust-lang.org/nightly/cargo/reference/build-scripts.html#rustc-check-cfg> for more information about checking conditional configuration

    warning: unexpected `cfg` condition name: `compile_error_if_std`
       --> src/lib.rs:443:11
        |
    443 | #[cfg(all(compile_error_if_std, feature = "std"))]
        |           ^^^^^^^^^^^^^^^^^^^^
        |
        = help: consider using a Cargo feature instead or adding `println!("cargo::rustc-check-cfg=cfg(compile_error_if_std)");` to the top of the `build.rs`
        = note: see <https://doc.rust-lang.org/nightly/cargo/reference/build-scripts.html#rustc-check-cfg> for more information about checking conditional configuration

    warning: unexpected `cfg` condition name: `doc_cfg`
       --> src/lib.rs:480:12
        |
    480 | #[cfg_attr(doc_cfg, doc(cfg(feature = "alloc")))]
        |            ^^^^^^^
        |
        = help: consider using a Cargo feature instead or adding `println!("cargo::rustc-check-cfg=cfg(doc_cfg)");` to the top of the `build.rs`
        = note: see <https://doc.rust-lang.org/nightly/cargo/reference/build-scripts.html#rustc-check-cfg> for more information about checking conditional configuration

    warning: unexpected `cfg` condition name: `no_core_ffi_c_char`
      --> src/c_char.rs:11:11
       |
    11 | #[cfg(not(no_core_ffi_c_char))]
       |           ^^^^^^^^^^^^^^^^^^
       |
       = help: consider using a Cargo feature instead or adding `println!("cargo::rustc-check-cfg=cfg(no_core_ffi_c_char)");` to the top of the `build.rs`
       = note: see <https://doc.rust-lang.org/nightly/cargo/reference/build-scripts.html#rustc-check-cfg> for more information about checking conditional configuration

    warning: unexpected `cfg` condition name: `no_core_ffi_c_char`
      --> src/c_char.rs:16:7
       |
    16 | #[cfg(no_core_ffi_c_char)]
       |       ^^^^^^^^^^^^^^^^^^
       |
       = help: consider using a Cargo feature instead or adding `println!("cargo::rustc-check-cfg=cfg(no_core_ffi_c_char)");` to the top of the `build.rs`
       = note: see <https://doc.rust-lang.org/nightly/cargo/reference/build-scripts.html#rustc-check-cfg> for more information about checking conditional configuration

    warning: unexpected `cfg` condition name: `doc_cfg`
     --> src/exception.rs:7:12
      |
    7 | #[cfg_attr(doc_cfg, doc(cfg(feature = "alloc")))]
      |            ^^^^^^^
      |
      = help: consider using a Cargo feature instead or adding `println!("cargo::rustc-check-cfg=cfg(doc_cfg)");` to the top of the `build.rs`
      = note: see <https://doc.rust-lang.org/nightly/cargo/reference/build-scripts.html#rustc-check-cfg> for more information about checking conditional configuration

    warning: unexpected `cfg` condition name: `doc_cfg`
      --> src/exception.rs:20:12
       |
    20 | #[cfg_attr(doc_cfg, doc(cfg(feature = "std")))]
       |            ^^^^^^^
       |
       = help: consider using a Cargo feature instead or adding `println!("cargo::rustc-check-cfg=cfg(doc_cfg)");` to the top of the `build.rs`
       = note: see <https://doc.rust-lang.org/nightly/cargo/reference/build-scripts.html#rustc-check-cfg> for more information about checking conditional configuration

    warning: unexpected `cfg` condition name: `doc_cfg`
       --> src/extern_type.rs:220:16
        |
    220 |     #[cfg_attr(doc_cfg, doc(cfg(feature = "alloc")))]
        |                ^^^^^^^
        |
        = help: consider using a Cargo feature instead or adding `println!("cargo::rustc-check-cfg=cfg(doc_cfg)");` to the top of the `build.rs`
        = note: see <https://doc.rust-lang.org/nightly/cargo/reference/build-scripts.html#rustc-check-cfg> for more information about checking conditional configuration

    warning: unexpected `cfg` condition name: `doc_cfg`
       --> src/cxx_string.rs:151:16
        |
    151 |     #[cfg_attr(doc_cfg, doc(cfg(feature = "alloc")))]
        |                ^^^^^^^
        |
        = help: consider using a Cargo feature instead or adding `println!("cargo::rustc-check-cfg=cfg(doc_cfg)");` to the top of the `build.rs`
        = note: see <https://doc.rust-lang.org/nightly/cargo/reference/build-scripts.html#rustc-check-cfg> for more information about checking conditional configuration

    warning: unexpected `cfg` condition name: `skip_ui_tests`
     --> tests/compiletest.rs:3:12
      |
    3 | #[cfg_attr(skip_ui_tests, ignore)]
      |            ^^^^^^^^^^^^^
      |
      = help: expected names are: `clippy`, `debug_assertions`, `doc`, `docsrs`, `doctest`, `feature`, `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`, `test`, `ub_checks`, `unix`, `windows`
      = help: consider using a Cargo feature instead or adding `println!("cargo::rustc-check-cfg=cfg(skip_ui_tests)");` to the top of the `build.rs`
      = note: see <https://doc.rust-lang.org/nightly/cargo/reference/build-scripts.html#rustc-check-cfg> for more information about checking conditional configuration
      = note: `#[warn(unexpected_cfgs)]` on by default
@dtolnay dtolnay merged commit 492f43d into master May 7, 2024
31 checks passed
@dtolnay dtolnay deleted the checkcfg branch May 7, 2024 22:31
@Urgau
Copy link

Urgau commented May 24, 2024

Heads up, with the release of rust-lang/cargo#13913 (in nightly-2024-05-19), there is no longer any need to allow the lint to avoid a build.rs as done in this PR. Cargo has now gain the ability to declare --check-cfg args directly inside the [lints] table with [lints.rust.unexpected_cfgs.check-cfg]1:

Cargo.toml:

[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(trybuild)'] }

Note that the diagnostic output of the lint has been updated to suggest the [lints] approach first. You can use it to guide you through the --check-cfg arguments that may need to be added.

Footnotes

  1. take effect on Rust 1.80 (current nightly), is ignored on Rust 1.79 (current beta), and produce an unused warning below

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants