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: `trybuild_no_target`
       --> src/cargo.rs:200:13
        |
    200 |     if cfg!(trybuild_no_target) {
        |             ^^^^^^^^^^^^^^^^^^
        |
        = 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_no_target)");` 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
  • Loading branch information
dtolnay committed May 7, 2024
1 parent 59ef19a commit 7bb6f2f
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions build.rs
Expand Up @@ -6,6 +6,8 @@ use std::path::Path;
fn main() -> io::Result<()> {
println!("cargo:rerun-if-changed=src/tests");

println!("cargo:rustc-check-cfg=cfg(trybuild_no_target)");

let out_dir = env::var_os("OUT_DIR").unwrap();
let target = env::var("TARGET").ok();
let path = Path::new(&out_dir).join("target");
Expand Down

0 comments on commit 7bb6f2f

Please sign in to comment.