Skip to content

Commit

Permalink
Merge pull request #456 from dtolnay/checkcfg
Browse files Browse the repository at this point in the history
Resolve unexpected_cfgs warning
  • Loading branch information
dtolnay committed May 7, 2024
2 parents fd2c998 + 5e02f52 commit 37c5d18
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions build.rs
Expand Up @@ -34,6 +34,9 @@
// macro API and catching a panic if it isn't available. Enabled on Rust
// 1.57+.

#![allow(unknown_lints)]
#![allow(unexpected_cfgs)]

use std::env;
use std::ffi::OsString;
use std::iter;
Expand All @@ -44,6 +47,23 @@ use std::str;
fn main() {
let rustc = rustc_minor_version().unwrap_or(u32::MAX);

if rustc >= 80 {
println!("cargo:rustc-check-cfg=cfg(doc_cfg)");
println!("cargo:rustc-check-cfg=cfg(fuzzing)");
println!("cargo:rustc-check-cfg=cfg(nightly)");
println!("cargo:rustc-check-cfg=cfg(no_is_available)");
println!("cargo:rustc-check-cfg=cfg(no_literal_byte_character)");
println!("cargo:rustc-check-cfg=cfg(no_literal_c_string)");
println!("cargo:rustc-check-cfg=cfg(no_source_text)");
println!("cargo:rustc-check-cfg=cfg(proc_macro_span)");
println!("cargo:rustc-check-cfg=cfg(procmacro2_backtrace)");
println!("cargo:rustc-check-cfg=cfg(procmacro2_nightly_testing)");
println!("cargo:rustc-check-cfg=cfg(procmacro2_semver_exempt)");
println!("cargo:rustc-check-cfg=cfg(span_locations)");
println!("cargo:rustc-check-cfg=cfg(super_unstable)");
println!("cargo:rustc-check-cfg=cfg(wrap_proc_macro)");
}

let docs_rs = env::var_os("DOCS_RS").is_some();
let semver_exempt = cfg!(procmacro2_semver_exempt) || docs_rs;
if semver_exempt {
Expand Down

0 comments on commit 37c5d18

Please sign in to comment.