Prevent various panics when deserializing malformed SystemTime

This commit is contained in:
Cary Yang
2021-03-05 17:02:25 -08:00
parent c261015325
commit 4118cec731
3 changed files with 68 additions and 3 deletions
+3 -1
View File
@@ -76,12 +76,14 @@ fn main() {
println!("cargo:rustc-cfg=serde_derive");
}
// TryFrom, Atomic types, and non-zero signed integers stabilized in Rust 1.34:
// TryFrom, Atomic types, non-zero signed integers, and `SystemTime::checked_add`
// 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#library-stabilizations
if minor >= 34 {
println!("cargo:rustc-cfg=core_try_from");
println!("cargo:rustc-cfg=num_nonzero_signed");
println!("cargo:rustc-cfg=systemtime_checked_add");
// Whitelist of archs that support std::sync::atomic module. Ideally we
// would use #[cfg(target_has_atomic = "...")] but it is not stable yet.