diff --git a/serde/build.rs b/serde/build.rs index 3a25498dae..f0aec2fbc1 100644 --- a/serde/build.rs +++ b/serde/build.rs @@ -13,6 +13,20 @@ fn main() { None => return, }; + if minor >= 77 { + println!("cargo:rustc-check-cfg=cfg(no_core_cstr)"); + println!("cargo:rustc-check-cfg=cfg(no_core_num_saturating)"); + println!("cargo:rustc-check-cfg=cfg(no_core_try_from)"); + println!("cargo:rustc-check-cfg=cfg(no_float_copysign)"); + println!("cargo:rustc-check-cfg=cfg(no_num_nonzero_signed)"); + println!("cargo:rustc-check-cfg=cfg(no_relaxed_trait_bounds)"); + println!("cargo:rustc-check-cfg=cfg(no_serde_derive)"); + println!("cargo:rustc-check-cfg=cfg(no_std_atomic)"); + println!("cargo:rustc-check-cfg=cfg(no_std_atomic64)"); + println!("cargo:rustc-check-cfg=cfg(no_systemtime_checked_add)"); + println!("cargo:rustc-check-cfg=cfg(no_target_has_atomic)"); + } + // TryFrom was stabilized in Rust 1.34: // https://blog.rust-lang.org/2019/04/11/Rust-1.34.0.html#tryfrom-and-tryinto if minor < 34 { diff --git a/serde_derive_internals/Cargo.toml b/serde_derive_internals/Cargo.toml index 095a7439cd..bf99c13998 100644 --- a/serde_derive_internals/Cargo.toml +++ b/serde_derive_internals/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "serde_derive_internals" -version = "0.29.0" +version = "0.29.1" authors = ["Erick Tryzelaar ", "David Tolnay "] description = "AST representation used by Serde derive macros. Unstable." documentation = "https://docs.rs/serde_derive_internals" diff --git a/serde_derive_internals/build.rs b/serde_derive_internals/build.rs index 25b5ef3132..b2bbb3a561 100644 --- a/serde_derive_internals/build.rs +++ b/serde_derive_internals/build.rs @@ -1,9 +1,17 @@ use std::path::Path; fn main() { + // Warning: build.rs is not published to crates.io. + println!("cargo:rerun-if-changed=build.rs"); println!("cargo:rerun-if-changed=src/mod.rs"); + println!("cargo:rustc-cfg=check_cfg"); + println!("cargo:rustc-check-cfg=cfg(check_cfg)"); + println!("cargo:rustc-check-cfg=cfg(exhaustive)"); + println!("cargo:rustc-check-cfg=cfg(serde_build_from_git)"); + println!("cargo:rustc-check-cfg=cfg(feature, values(\"deserialize_in_place\"))"); + // Sometimes on Windows the git checkout does not correctly wire up the // symlink from serde_derive_internals/src to serde_derive/src/internals. // When this happens we'll just build based on relative paths within the git diff --git a/serde_derive_internals/lib.rs b/serde_derive_internals/lib.rs index 1053b009ae..6edb07ee0c 100644 --- a/serde_derive_internals/lib.rs +++ b/serde_derive_internals/lib.rs @@ -1,4 +1,5 @@ -#![doc(html_root_url = "https://docs.rs/serde_derive_internals/0.29.0")] +#![doc(html_root_url = "https://docs.rs/serde_derive_internals/0.29.1")] +#![cfg_attr(not(check_cfg), allow(unexpected_cfgs))] // Ignored clippy lints #![allow( clippy::cognitive_complexity, diff --git a/test_suite/tests/test_de_error.rs b/test_suite/tests/test_de_error.rs index 75c7e30304..cae5eddaba 100644 --- a/test_suite/tests/test_de_error.rs +++ b/test_suite/tests/test_de_error.rs @@ -1524,7 +1524,6 @@ fn test_systemtime_overflow_struct() { ); } -#[cfg(systemtime_checked_add)] #[test] fn test_systemtime_overflow() { assert_de_tokens_error::(