diff --git a/build.rs b/build.rs index a6c89ccc0..ba43c7aa9 100644 --- a/build.rs +++ b/build.rs @@ -1,3 +1,6 @@ +#![allow(unknown_lints)] +#![allow(unexpected_cfgs)] + use std::env; use std::path::{Path, PathBuf}; use std::process::Command; @@ -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!( diff --git a/tests/ffi/build.rs b/tests/ffi/build.rs index 7051cf0b8..98f9af52c 100644 --- a/tests/ffi/build.rs +++ b/tests/ffi/build.rs @@ -1,3 +1,6 @@ +#![allow(unknown_lints)] +#![allow(unexpected_cfgs)] + use cxx_build::CFG; fn main() { diff --git a/tools/cargo/build.rs b/tools/cargo/build.rs index 401c74186..4034ec839 100644 --- a/tools/cargo/build.rs +++ b/tools/cargo/build.rs @@ -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; }