Skip to content

Commit

Permalink
Fix unexpected_cfgs warning
Browse files Browse the repository at this point in the history
```
  error: unexpected `cfg` condition name: `slab_no_const_vec_new`
     --> src/lib.rs:252:15
      |
  252 |     #[cfg(not(slab_no_const_vec_new))]
      |               ^^^^^^^^^^^^^^^^^^^^^
      |
      = 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`, and `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(slab_no_const_vec_new)'] }
      = help: or consider adding `println!("cargo::rustc-check-cfg=cfg(slab_no_const_vec_new)");` 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 checking conditional configuration
      = note: `-D unexpected-cfgs` implied by `-D warnings`
      = help: to override `-D warnings` add `#[allow(unexpected_cfgs)]`

  error: unexpected `cfg` condition name: `slab_no_const_vec_new`
     --> src/lib.rs:266:11
      |
  266 |     #[cfg(slab_no_const_vec_new)]
      |           ^^^^^^^^^^^^^^^^^^^^^
      |
      = 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(slab_no_const_vec_new)'] }
      = help: or consider adding `println!("cargo::rustc-check-cfg=cfg(slab_no_const_vec_new)");` 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 checking conditional configuration

  error: unexpected `cfg` condition name: `slab_no_track_caller`
     --> src/lib.rs:931:20
      |
  931 |     #[cfg_attr(not(slab_no_track_caller), track_caller)]
      |                    ^^^^^^^^^^^^^^^^^^^^
      |
      = 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(slab_no_track_caller)'] }
      = help: or consider adding `println!("cargo::rustc-check-cfg=cfg(slab_no_track_caller)");` 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 checking conditional configuration

  error: unexpected `cfg` condition name: `slab_no_track_caller`
      --> src/lib.rs:1100:20
       |
  1100 |     #[cfg_attr(not(slab_no_track_caller), track_caller)]
       |                    ^^^^^^^^^^^^^^^^^^^^
       |
       = 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(slab_no_track_caller)'] }
       = help: or consider adding `println!("cargo::rustc-check-cfg=cfg(slab_no_track_caller)");` 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 checking conditional configuration

  error: unexpected `cfg` condition name: `slab_no_track_caller`
      --> src/lib.rs:1208:20
       |
  1208 |     #[cfg_attr(not(slab_no_track_caller), track_caller)]
       |                    ^^^^^^^^^^^^^^^^^^^^
       |
       = 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(slab_no_track_caller)'] }
       = help: or consider adding `println!("cargo::rustc-check-cfg=cfg(slab_no_track_caller)");` 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 checking conditional configuration

  error: unexpected `cfg` condition name: `slab_no_track_caller`
      --> src/lib.rs:1218:20
       |
  1218 |     #[cfg_attr(not(slab_no_track_caller), track_caller)]
       |                    ^^^^^^^^^^^^^^^^^^^^
       |
       = 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(slab_no_track_caller)'] }
       = help: or consider adding `println!("cargo::rustc-check-cfg=cfg(slab_no_track_caller)");` 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 checking conditional configuration
```
  • Loading branch information
taiki-e committed Sep 15, 2024
1 parent f7b621f commit a5381f1
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
fn main() {
println!("cargo:rerun-if-changed=build.rs");
println!("cargo:rustc-check-cfg=cfg(slab_no_const_vec_new,slab_no_track_caller)");

let cfg = match autocfg::AutoCfg::new() {
Ok(cfg) => cfg,
Err(e) => {
Expand Down

0 comments on commit a5381f1

Please sign in to comment.