Delete support for compilers without core::time

This commit is contained in:
David Tolnay
2023-07-30 20:51:55 -07:00
parent 27c8b2d66a
commit 4f59cd217a
7 changed files with 8 additions and 20 deletions
+1 -1
View File
@@ -11,7 +11,7 @@ keywords = ["serde", "serialization", "no_std"]
license = "MIT OR Apache-2.0"
readme = "crates-io.md"
repository = "https://github.com/serde-rs/serde"
rust-version = "1.21"
rust-version = "1.25"
[dependencies]
serde_derive = { version = "=1.0.179", optional = true, path = "../serde_derive" }
-6
View File
@@ -16,12 +16,6 @@ fn main() {
let target = env::var("TARGET").unwrap();
let emscripten = target == "asmjs-unknown-emscripten" || target == "wasm32-unknown-emscripten";
// Duration available in core since Rust 1.25:
// https://blog.rust-lang.org/2018/03/29/Rust-1.25.html#library-stabilizations
if minor < 25 {
println!("cargo:rustc-cfg=no_core_duration");
}
// std::collections::Bound was stabilized in Rust 1.17
// but it was moved to core::ops later in Rust 1.26:
// https://doc.rust-lang.org/core/ops/enum.Bound.html
+2 -5
View File
@@ -1,12 +1,10 @@
use lib::*;
use de::{
Deserialize, Deserializer, EnumAccess, Error, SeqAccess, Unexpected, VariantAccess, Visitor,
Deserialize, Deserializer, EnumAccess, Error, MapAccess, SeqAccess, Unexpected, VariantAccess,
Visitor,
};
#[cfg(any(feature = "std", feature = "alloc", not(no_core_duration)))]
use de::MapAccess;
use seed::InPlaceSeed;
#[cfg(any(feature = "std", feature = "alloc"))]
@@ -1923,7 +1921,6 @@ forwarded_impl!((T), RwLock<T>, RwLock::new);
// secs: u64,
// nanos: u32,
// }
#[cfg(any(feature = "std", not(no_core_duration)))]
impl<'de> Deserialize<'de> for Duration {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
+1 -3
View File
@@ -186,6 +186,7 @@ mod lib {
pub use self::core::ops::{Range, RangeFrom, RangeTo};
pub use self::core::option::{self, Option};
pub use self::core::result::{self, Result};
pub use self::core::time::Duration;
#[cfg(all(feature = "alloc", not(feature = "std")))]
pub use alloc::borrow::{Cow, ToOwned};
@@ -279,9 +280,6 @@ mod lib {
pub use std::sync::atomic::{AtomicI64, AtomicU64};
#[cfg(all(feature = "std", not(no_target_has_atomic), target_has_atomic = "ptr"))]
pub use std::sync::atomic::{AtomicIsize, AtomicUsize};
#[cfg(any(feature = "std", not(no_core_duration)))]
pub use self::core::time::Duration;
}
// None of this crate's error handling needs the `From::from` error conversion
-1
View File
@@ -662,7 +662,6 @@ where
////////////////////////////////////////////////////////////////////////////////
#[cfg(any(feature = "std", not(no_core_duration)))]
impl Serialize for Duration {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where