Skip to content

Commit

Permalink
Resolve unexpected_cfgs warning
Browse files Browse the repository at this point in the history
    warning: unexpected `cfg` condition name: `doc_cfg`
      --> src/lib.rs:64:13
       |
    64 | #![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: `no_alloc_crate`
      --> src/lib.rs:65:43
       |
    65 | #![cfg_attr(all(not(feature = "std"), not(no_alloc_crate)), no_std)]
       |                                           ^^^^^^^^^^^^^^
       |
       = help: consider using a Cargo feature instead or adding `println!("cargo::rustc-check-cfg=cfg(no_alloc_crate)");` 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_unsafe_op_in_unsafe_fn_lint`
      --> src/lib.rs:66:17
       |
    66 | #![cfg_attr(not(no_unsafe_op_in_unsafe_fn_lint), deny(unsafe_op_in_unsafe_fn))]
       |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
       |
       = help: consider using a Cargo feature instead or adding `println!("cargo::rustc-check-cfg=cfg(no_unsafe_op_in_unsafe_fn_lint)");` 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_unsafe_op_in_unsafe_fn_lint`
      --> src/lib.rs:67:13
       |
    67 | #![cfg_attr(no_unsafe_op_in_unsafe_fn_lint, allow(unused_unsafe))]
       |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
       |
       = help: consider using a Cargo feature instead or adding `println!("cargo::rustc-check-cfg=cfg(no_unsafe_op_in_unsafe_fn_lint)");` 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_str_strip_prefix`
      --> src/lib.rs:68:13
       |
    68 | #![cfg_attr(no_str_strip_prefix, allow(unstable_name_collisions))]
       |             ^^^^^^^^^^^^^^^^^^^
       |
       = help: consider using a Cargo feature instead or adding `println!("cargo::rustc-check-cfg=cfg(no_str_strip_prefix)");` 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_alloc_crate`
      --> src/lib.rs:89:11
       |
    89 | #[cfg(not(no_alloc_crate))]
       |           ^^^^^^^^^^^^^^
       |
       = help: consider using a Cargo feature instead or adding `println!("cargo::rustc-check-cfg=cfg(no_alloc_crate)");` 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_const_vec_new`
       --> src/lib.rs:188:12
        |
    188 | #[cfg_attr(no_const_vec_new, derive(Default))]
        |            ^^^^^^^^^^^^^^^^
        |
        = help: consider using a Cargo feature instead or adding `println!("cargo::rustc-check-cfg=cfg(no_const_vec_new)");` 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_non_exhaustive`
       --> src/lib.rs:252:16
        |
    252 | #[cfg_attr(not(no_non_exhaustive), non_exhaustive)]
        |                ^^^^^^^^^^^^^^^^^
        |
        = help: consider using a Cargo feature instead or adding `println!("cargo::rustc-check-cfg=cfg(no_non_exhaustive)");` 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_const_vec_new`
       --> src/lib.rs:529:11
        |
    529 | #[cfg(not(no_const_vec_new))]
        |           ^^^^^^^^^^^^^^^^
        |
        = help: consider using a Cargo feature instead or adding `println!("cargo::rustc-check-cfg=cfg(no_const_vec_new)");` 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_non_exhaustive`
       --> src/lib.rs:263:11
        |
    263 |     #[cfg(no_non_exhaustive)] // rustc <1.40
        |           ^^^^^^^^^^^^^^^^^
        |
        = help: consider using a Cargo feature instead or adding `println!("cargo::rustc-check-cfg=cfg(no_non_exhaustive)");` 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_str_strip_prefix`
     --> src/backport.rs:1:7
      |
    1 | #[cfg(no_str_strip_prefix)] // rustc <1.45
      |       ^^^^^^^^^^^^^^^^^^^
      |
      = help: consider using a Cargo feature instead or adding `println!("cargo::rustc-check-cfg=cfg(no_str_strip_prefix)");` 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_str_strip_prefix`
     --> src/backport.rs:6:7
      |
    6 | #[cfg(no_str_strip_prefix)]
      |       ^^^^^^^^^^^^^^^^^^^
      |
      = help: consider using a Cargo feature instead or adding `println!("cargo::rustc-check-cfg=cfg(no_str_strip_prefix)");` 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_alloc_crate`
      --> src/backport.rs:19:7
       |
    19 | #[cfg(no_alloc_crate)] // rustc <1.36
       |       ^^^^^^^^^^^^^^
       |
       = help: consider using a Cargo feature instead or adding `println!("cargo::rustc-check-cfg=cfg(no_alloc_crate)");` 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_non_exhaustive`
      --> src/display.rs:59:19
       |
    59 |             #[cfg(no_non_exhaustive)]
       |                   ^^^^^^^^^^^^^^^^^
       |
       = help: consider using a Cargo feature instead or adding `println!("cargo::rustc-check-cfg=cfg(no_non_exhaustive)");` 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/error.rs:29:12
       |
    29 | #[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: `no_non_exhaustive`
      --> src/eval.rs:39:15
       |
    39 |         #[cfg(no_non_exhaustive)]
       |               ^^^^^^^^^^^^^^^^^
       |
       = help: consider using a Cargo feature instead or adding `println!("cargo::rustc-check-cfg=cfg(no_non_exhaustive)");` 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_exhaustive_int_match`
       --> src/identifier.rs:166:19
        |
    166 |             #[cfg(no_exhaustive_int_match)] // rustc <1.33
        |                   ^^^^^^^^^^^^^^^^^^^^^^^
        |
        = help: consider using a Cargo feature instead or adding `println!("cargo::rustc-check-cfg=cfg(no_exhaustive_int_match)");` 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_nonzero_bitscan`
       --> src/identifier.rs:327:11
        |
    327 |     #[cfg(no_nonzero_bitscan)]
        |           ^^^^^^^^^^^^^^^^^^
        |
        = help: consider using a Cargo feature instead or adding `println!("cargo::rustc-check-cfg=cfg(no_nonzero_bitscan)");` 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_nonzero_bitscan`
       --> src/identifier.rs:416:11
        |
    416 |     #[cfg(no_nonzero_bitscan)] // rustc <1.53
        |           ^^^^^^^^^^^^^^^^^^
        |
        = help: consider using a Cargo feature instead or adding `println!("cargo::rustc-check-cfg=cfg(no_nonzero_bitscan)");` 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_const_vec_new`
      --> src/parse.rs:92:27
       |
    92 |                 #[cfg(not(no_const_vec_new))]
       |                           ^^^^^^^^^^^^^^^^
       |
       = help: consider using a Cargo feature instead or adding `println!("cargo::rustc-check-cfg=cfg(no_const_vec_new)");` 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_const_vec_new`
      --> src/parse.rs:94:23
       |
    94 |                 #[cfg(no_const_vec_new)] // rustc <1.39
       |                       ^^^^^^^^^^^^^^^^
       |
       = help: consider using a Cargo feature instead or adding `println!("cargo::rustc-check-cfg=cfg(no_const_vec_new)");` 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_const_vec_new`
       --> src/lib.rs:497:15
        |
    497 |     #[cfg(not(no_const_vec_new))] // rustc <1.39
        |               ^^^^^^^^^^^^^^^^
        |
        = help: consider using a Cargo feature instead or adding `println!("cargo::rustc-check-cfg=cfg(no_const_vec_new)");` 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
  • Loading branch information
dtolnay committed May 7, 2024
1 parent c520af7 commit 5b71485
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,19 @@ fn main() {
None => return,
};

if compiler >= 80 {
println!("cargo:rustc-check-cfg=cfg(doc_cfg)");
println!("cargo:rustc-check-cfg=cfg(no_alloc_crate)");
println!("cargo:rustc-check-cfg=cfg(no_const_vec_new)");
println!("cargo:rustc-check-cfg=cfg(no_exhaustive_int_match)");
println!("cargo:rustc-check-cfg=cfg(no_non_exhaustive)");
println!("cargo:rustc-check-cfg=cfg(no_nonzero_bitscan)");
println!("cargo:rustc-check-cfg=cfg(no_str_strip_prefix)");
println!("cargo:rustc-check-cfg=cfg(no_track_caller)");
println!("cargo:rustc-check-cfg=cfg(no_unsafe_op_in_unsafe_fn_lint)");
println!("cargo:rustc-check-cfg=cfg(test_node_semver)");
}

if compiler < 33 {
// Exhaustive integer patterns. On older compilers, a final `_` arm is
// required even if every possible integer value is otherwise covered.
Expand Down

0 comments on commit 5b71485

Please sign in to comment.