Skip to content

Commit 492f43d

Browse files
authored
Merge pull request #1344 from dtolnay/checkcfg
Resolve unexpected_cfgs warning
2 parents b0f010f + cbc47f0 commit 492f43d

File tree

3 files changed

+19
-0
lines changed

3 files changed

+19
-0
lines changed

build.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
#![allow(unknown_lints)]
2+
#![allow(unexpected_cfgs)]
3+
14
use std::env;
25
use std::path::{Path, PathBuf};
36
use std::process::Command;
@@ -24,6 +27,16 @@ fn main() {
2427
}
2528

2629
if let Some(rustc) = rustc_version() {
30+
if rustc.minor >= 80 {
31+
println!("cargo:rustc-check-cfg=cfg(built_with_cargo)");
32+
println!("cargo:rustc-check-cfg=cfg(compile_error_if_alloc)");
33+
println!("cargo:rustc-check-cfg=cfg(compile_error_if_std)");
34+
println!("cargo:rustc-check-cfg=cfg(cxx_experimental_no_alloc)");
35+
println!("cargo:rustc-check-cfg=cfg(doc_cfg)");
36+
println!("cargo:rustc-check-cfg=cfg(no_core_ffi_c_char)");
37+
println!("cargo:rustc-check-cfg=cfg(skip_ui_tests)");
38+
}
39+
2740
if rustc.minor < 63 {
2841
println!("cargo:warning=The cxx crate requires a rustc version 1.63.0 or newer.");
2942
println!(

tests/ffi/build.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
#![allow(unknown_lints)]
2+
#![allow(unexpected_cfgs)]
3+
14
use cxx_build::CFG;
25

36
fn main() {

tools/cargo/build.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ through crates.io.
4848
";
4949

5050
fn main() {
51+
println!("cargo:rustc-check-cfg=cfg(feature, values(\"experimental-async-fn\"))");
52+
println!("cargo:rustc-check-cfg=cfg(feature, values(\"experimental-enum-variants-from-header\"))");
53+
5154
if Path::new("src/syntax/mod.rs").exists() {
5255
return;
5356
}

0 commit comments

Comments
 (0)