mirror of
https://github.com/pezkuwichain/serde.git
synced 2026-06-12 20:11:02 +00:00
Add build gate for nonzero signed integers so rustc <1.34 still works
This commit is contained in:
+2
-1
@@ -69,11 +69,12 @@ fn main() {
|
|||||||
println!("cargo:rustc-cfg=num_nonzero");
|
println!("cargo:rustc-cfg=num_nonzero");
|
||||||
}
|
}
|
||||||
|
|
||||||
// TryFrom and Atomic types stabilized in Rust 1.34:
|
// TryFrom, Atomic types, and non-zero signed integers stabilized in Rust 1.34:
|
||||||
// https://blog.rust-lang.org/2019/04/11/Rust-1.34.0.html#tryfrom-and-tryinto
|
// https://blog.rust-lang.org/2019/04/11/Rust-1.34.0.html#tryfrom-and-tryinto
|
||||||
// https://blog.rust-lang.org/2019/04/11/Rust-1.34.0.html#library-stabilizations
|
// https://blog.rust-lang.org/2019/04/11/Rust-1.34.0.html#library-stabilizations
|
||||||
if minor >= 34 {
|
if minor >= 34 {
|
||||||
println!("cargo:rustc-cfg=core_try_from");
|
println!("cargo:rustc-cfg=core_try_from");
|
||||||
|
println!("cargo:rustc-cfg=num_nonzero_signed");
|
||||||
|
|
||||||
// Whitelist of archs that support std::sync::atomic module. Ideally we
|
// Whitelist of archs that support std::sync::atomic module. Ideally we
|
||||||
// would use #[cfg(target_has_atomic = "...")] but it is not stable yet.
|
// would use #[cfg(target_has_atomic = "...")] but it is not stable yet.
|
||||||
|
|||||||
@@ -2409,6 +2409,10 @@ nonzero_integers! {
|
|||||||
NonZeroU32,
|
NonZeroU32,
|
||||||
NonZeroU64,
|
NonZeroU64,
|
||||||
NonZeroUsize,
|
NonZeroUsize,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(num_nonzero_signed)]
|
||||||
|
nonzero_integers! {
|
||||||
NonZeroI8,
|
NonZeroI8,
|
||||||
NonZeroI16,
|
NonZeroI16,
|
||||||
NonZeroI32,
|
NonZeroI32,
|
||||||
@@ -2421,6 +2425,10 @@ nonzero_integers! {
|
|||||||
serde_if_integer128! {
|
serde_if_integer128! {
|
||||||
nonzero_integers! {
|
nonzero_integers! {
|
||||||
NonZeroU128,
|
NonZeroU128,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(num_nonzero_signed)]
|
||||||
|
nonzero_integers! {
|
||||||
NonZeroI128,
|
NonZeroI128,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -486,6 +486,10 @@ nonzero_integers! {
|
|||||||
NonZeroU32,
|
NonZeroU32,
|
||||||
NonZeroU64,
|
NonZeroU64,
|
||||||
NonZeroUsize,
|
NonZeroUsize,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(num_nonzero_signed)]
|
||||||
|
nonzero_integers! {
|
||||||
NonZeroI8,
|
NonZeroI8,
|
||||||
NonZeroI16,
|
NonZeroI16,
|
||||||
NonZeroI32,
|
NonZeroI32,
|
||||||
@@ -498,6 +502,10 @@ nonzero_integers! {
|
|||||||
serde_if_integer128! {
|
serde_if_integer128! {
|
||||||
nonzero_integers! {
|
nonzero_integers! {
|
||||||
NonZeroU128,
|
NonZeroU128,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(num_nonzero_signed)]
|
||||||
|
nonzero_integers! {
|
||||||
NonZeroI128,
|
NonZeroI128,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user