Skip to content

Commit

Permalink
Merge pull request #1344 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 b0f010f + cbc47f0 commit 492f43d
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
13 changes: 13 additions & 0 deletions build.rs
@@ -1,3 +1,6 @@
#![allow(unknown_lints)]
#![allow(unexpected_cfgs)]

use std::env;
use std::path::{Path, PathBuf};
use std::process::Command;
Expand All @@ -24,6 +27,16 @@ fn main() {
}

if let Some(rustc) = rustc_version() {
if rustc.minor >= 80 {
println!("cargo:rustc-check-cfg=cfg(built_with_cargo)");
println!("cargo:rustc-check-cfg=cfg(compile_error_if_alloc)");
println!("cargo:rustc-check-cfg=cfg(compile_error_if_std)");
println!("cargo:rustc-check-cfg=cfg(cxx_experimental_no_alloc)");
println!("cargo:rustc-check-cfg=cfg(doc_cfg)");
println!("cargo:rustc-check-cfg=cfg(no_core_ffi_c_char)");
println!("cargo:rustc-check-cfg=cfg(skip_ui_tests)");
}

if rustc.minor < 63 {
println!("cargo:warning=The cxx crate requires a rustc version 1.63.0 or newer.");
println!(
Expand Down
3 changes: 3 additions & 0 deletions tests/ffi/build.rs
@@ -1,3 +1,6 @@
#![allow(unknown_lints)]
#![allow(unexpected_cfgs)]

use cxx_build::CFG;

fn main() {
Expand Down
3 changes: 3 additions & 0 deletions tools/cargo/build.rs
Expand Up @@ -48,6 +48,9 @@ through crates.io.
";

fn main() {
println!("cargo:rustc-check-cfg=cfg(feature, values(\"experimental-async-fn\"))");
println!("cargo:rustc-check-cfg=cfg(feature, values(\"experimental-enum-variants-from-header\"))");

if Path::new("src/syntax/mod.rs").exists() {
return;
}
Expand Down

0 comments on commit 492f43d

Please sign in to comment.