Skip to content

Commit ffe914d

Browse files
committed
Add rustc-check-cfg to serde build.rs
1 parent 1868dad commit ffe914d

File tree

5 files changed

+25
-3
lines changed

5 files changed

+25
-3
lines changed

serde/build.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,20 @@ fn main() {
1313
None => return,
1414
};
1515

16+
if minor >= 77 {
17+
println!("cargo:rustc-check-cfg=cfg(no_core_cstr)");
18+
println!("cargo:rustc-check-cfg=cfg(no_core_num_saturating)");
19+
println!("cargo:rustc-check-cfg=cfg(no_core_try_from)");
20+
println!("cargo:rustc-check-cfg=cfg(no_float_copysign)");
21+
println!("cargo:rustc-check-cfg=cfg(no_num_nonzero_signed)");
22+
println!("cargo:rustc-check-cfg=cfg(no_relaxed_trait_bounds)");
23+
println!("cargo:rustc-check-cfg=cfg(no_serde_derive)");
24+
println!("cargo:rustc-check-cfg=cfg(no_std_atomic)");
25+
println!("cargo:rustc-check-cfg=cfg(no_std_atomic64)");
26+
println!("cargo:rustc-check-cfg=cfg(no_systemtime_checked_add)");
27+
println!("cargo:rustc-check-cfg=cfg(no_target_has_atomic)");
28+
}
29+
1630
// TryFrom was stabilized in Rust 1.34:
1731
// https://blog.rust-lang.org/2019/04/11/Rust-1.34.0.html#tryfrom-and-tryinto
1832
if minor < 34 {

serde_derive_internals/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "serde_derive_internals"
3-
version = "0.29.0"
3+
version = "0.29.1"
44
authors = ["Erick Tryzelaar <[email protected]>", "David Tolnay <[email protected]>"]
55
description = "AST representation used by Serde derive macros. Unstable."
66
documentation = "https://docs.rs/serde_derive_internals"

serde_derive_internals/build.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,17 @@
11
use std::path::Path;
22

33
fn main() {
4+
// Warning: build.rs is not published to crates.io.
5+
46
println!("cargo:rerun-if-changed=build.rs");
57
println!("cargo:rerun-if-changed=src/mod.rs");
68

9+
println!("cargo:rustc-cfg=check_cfg");
10+
println!("cargo:rustc-check-cfg=cfg(check_cfg)");
11+
println!("cargo:rustc-check-cfg=cfg(exhaustive)");
12+
println!("cargo:rustc-check-cfg=cfg(serde_build_from_git)");
13+
println!("cargo:rustc-check-cfg=cfg(feature, values(\"deserialize_in_place\"))");
14+
715
// Sometimes on Windows the git checkout does not correctly wire up the
816
// symlink from serde_derive_internals/src to serde_derive/src/internals.
917
// When this happens we'll just build based on relative paths within the git

serde_derive_internals/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
#![doc(html_root_url = "https://docs.rs/serde_derive_internals/0.29.0")]
1+
#![doc(html_root_url = "https://docs.rs/serde_derive_internals/0.29.1")]
2+
#![cfg_attr(not(check_cfg), allow(unexpected_cfgs))]
23
// Ignored clippy lints
34
#![allow(
45
clippy::cognitive_complexity,

test_suite/tests/test_de_error.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1524,7 +1524,6 @@ fn test_systemtime_overflow_struct() {
15241524
);
15251525
}
15261526

1527-
#[cfg(systemtime_checked_add)]
15281527
#[test]
15291528
fn test_systemtime_overflow() {
15301529
assert_de_tokens_error::<SystemTime>(

0 commit comments

Comments
 (0)