From 4f59cd217a13311916cbcdee99cea7e34a509d75 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Sun, 30 Jul 2023 20:51:55 -0700 Subject: [PATCH] Delete support for compilers without core::time --- .github/workflows/ci.yml | 2 +- README.md | 6 +++--- serde/Cargo.toml | 2 +- serde/build.rs | 6 ------ serde/src/de/impls.rs | 7 ++----- serde/src/lib.rs | 4 +--- serde/src/ser/impls.rs | 1 - 7 files changed, 8 insertions(+), 20 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c5946877..0275ea87 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -77,7 +77,7 @@ jobs: strategy: fail-fast: false matrix: - rust: [1.21.0, 1.25.0, 1.26.0, 1.34.0] + rust: [1.25.0, 1.26.0, 1.34.0] timeout-minutes: 45 steps: - uses: actions/checkout@v3 diff --git a/README.md b/README.md index 234481b6..74e0ee98 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,12 @@ -# Serde   [![Build Status]][actions] [![Latest Version]][crates.io] [![serde: rustc 1.21+]][Rust 1.21] [![serde_derive: rustc 1.56+]][Rust 1.56] +# Serde   [![Build Status]][actions] [![Latest Version]][crates.io] [![serde: rustc 1.25+]][Rust 1.25] [![serde_derive: rustc 1.56+]][Rust 1.56] [Build Status]: https://img.shields.io/github/actions/workflow/status/serde-rs/serde/ci.yml?branch=master [actions]: https://github.com/serde-rs/serde/actions?query=branch%3Amaster [Latest Version]: https://img.shields.io/crates/v/serde.svg [crates.io]: https://crates.io/crates/serde -[serde: rustc 1.21+]: https://img.shields.io/badge/serde-rustc_1.21+-lightgray.svg +[serde: rustc 1.25+]: https://img.shields.io/badge/serde-rustc_1.25+-lightgray.svg [serde_derive: rustc 1.56+]: https://img.shields.io/badge/serde_derive-rustc_1.56+-lightgray.svg -[Rust 1.21]: https://blog.rust-lang.org/2017/10/12/Rust-1.21.html +[Rust 1.25]: https://blog.rust-lang.org/2018/03/29/Rust-1.25.html [Rust 1.56]: https://blog.rust-lang.org/2021/10/21/Rust-1.56.0.html **Serde is a framework for *ser*ializing and *de*serializing Rust data structures efficiently and generically.** diff --git a/serde/Cargo.toml b/serde/Cargo.toml index 2fd97920..53e4d414 100644 --- a/serde/Cargo.toml +++ b/serde/Cargo.toml @@ -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" } diff --git a/serde/build.rs b/serde/build.rs index 9c774800..fd03d042 100644 --- a/serde/build.rs +++ b/serde/build.rs @@ -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 diff --git a/serde/src/de/impls.rs b/serde/src/de/impls.rs index cfac3518..0102a7ab 100644 --- a/serde/src/de/impls.rs +++ b/serde/src/de/impls.rs @@ -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, RwLock::new); // secs: u64, // nanos: u32, // } -#[cfg(any(feature = "std", not(no_core_duration)))] impl<'de> Deserialize<'de> for Duration { fn deserialize(deserializer: D) -> Result where diff --git a/serde/src/lib.rs b/serde/src/lib.rs index a8e56883..0ef1b6c5 100644 --- a/serde/src/lib.rs +++ b/serde/src/lib.rs @@ -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 diff --git a/serde/src/ser/impls.rs b/serde/src/ser/impls.rs index 541acf2d..9469e714 100644 --- a/serde/src/ser/impls.rs +++ b/serde/src/ser/impls.rs @@ -662,7 +662,6 @@ where //////////////////////////////////////////////////////////////////////////////// -#[cfg(any(feature = "std", not(no_core_duration)))] impl Serialize for Duration { fn serialize(&self, serializer: S) -> Result where