Delete support for compilers without dynamically sized Rc construction

This commit is contained in:
David Tolnay 2023-07-27 22:38:04 -07:00
parent 89976c2712
commit 27c8b2d66a
No known key found for this signature in database
GPG Key ID: F9BA143B95FF6D82
5 changed files with 8 additions and 51 deletions

View File

@ -77,7 +77,7 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
rust: [1.20.0, 1.21.0, 1.25.0, 1.26.0, 1.34.0] rust: [1.21.0, 1.25.0, 1.26.0, 1.34.0]
timeout-minutes: 45 timeout-minutes: 45
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3

View File

@ -1,12 +1,12 @@
# Serde   [![Build Status]][actions] [![Latest Version]][crates.io] [![serde: rustc 1.20+]][Rust 1.20] [![serde_derive: rustc 1.56+]][Rust 1.56] # Serde   [![Build Status]][actions] [![Latest Version]][crates.io] [![serde: rustc 1.21+]][Rust 1.21] [![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 [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 [actions]: https://github.com/serde-rs/serde/actions?query=branch%3Amaster
[Latest Version]: https://img.shields.io/crates/v/serde.svg [Latest Version]: https://img.shields.io/crates/v/serde.svg
[crates.io]: https://crates.io/crates/serde [crates.io]: https://crates.io/crates/serde
[serde: rustc 1.20+]: https://img.shields.io/badge/serde-rustc_1.20+-lightgray.svg [serde: rustc 1.21+]: https://img.shields.io/badge/serde-rustc_1.21+-lightgray.svg
[serde_derive: rustc 1.56+]: https://img.shields.io/badge/serde_derive-rustc_1.56+-lightgray.svg [serde_derive: rustc 1.56+]: https://img.shields.io/badge/serde_derive-rustc_1.56+-lightgray.svg
[Rust 1.20]: https://blog.rust-lang.org/2017/08/31/Rust-1.20.html [Rust 1.21]: https://blog.rust-lang.org/2017/10/12/Rust-1.21.html
[Rust 1.56]: https://blog.rust-lang.org/2021/10/21/Rust-1.56.0.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.** **Serde is a framework for *ser*ializing and *de*serializing Rust data structures efficiently and generically.**

View File

@ -11,7 +11,7 @@ keywords = ["serde", "serialization", "no_std"]
license = "MIT OR Apache-2.0" license = "MIT OR Apache-2.0"
readme = "crates-io.md" readme = "crates-io.md"
repository = "https://github.com/serde-rs/serde" repository = "https://github.com/serde-rs/serde"
rust-version = "1.20" rust-version = "1.21"
[dependencies] [dependencies]
serde_derive = { version = "=1.0.179", optional = true, path = "../serde_derive" } serde_derive = { version = "=1.0.179", optional = true, path = "../serde_derive" }

View File

@ -16,13 +16,6 @@ fn main() {
let target = env::var("TARGET").unwrap(); let target = env::var("TARGET").unwrap();
let emscripten = target == "asmjs-unknown-emscripten" || target == "wasm32-unknown-emscripten"; let emscripten = target == "asmjs-unknown-emscripten" || target == "wasm32-unknown-emscripten";
// From<Box<T>> for Rc<T> / Arc<T> stabilized in Rust 1.21:
// https://doc.rust-lang.org/std/rc/struct.Rc.html#impl-From<Box<T>>
// https://doc.rust-lang.org/std/sync/struct.Arc.html#impl-From<Box<T>>
if minor < 21 {
println!("cargo:rustc-cfg=no_de_rc_dst");
}
// Duration available in core since Rust 1.25: // Duration available in core since Rust 1.25:
// https://blog.rust-lang.org/2018/03/29/Rust-1.25.html#library-stabilizations // https://blog.rust-lang.org/2018/03/29/Rust-1.25.html#library-stabilizations
if minor < 25 { if minor < 25 {

View File

@ -1791,30 +1791,6 @@ forwarded_impl!((T), Box<[T]>, Vec::into_boxed_slice);
#[cfg(any(feature = "std", feature = "alloc"))] #[cfg(any(feature = "std", feature = "alloc"))]
forwarded_impl!((), Box<str>, String::into_boxed_str); forwarded_impl!((), Box<str>, String::into_boxed_str);
#[cfg(all(no_de_rc_dst, feature = "rc", any(feature = "std", feature = "alloc")))]
forwarded_impl! {
/// This impl requires the [`"rc"`] Cargo feature of Serde.
///
/// Deserializing a data structure containing `Arc` will not attempt to
/// deduplicate `Arc` references to the same data. Every deserialized `Arc`
/// will end up with a strong count of 1.
///
/// [`"rc"`]: https://serde.rs/feature-flags.html#-features-rc
(T), Arc<T>, Arc::new
}
#[cfg(all(no_de_rc_dst, feature = "rc", any(feature = "std", feature = "alloc")))]
forwarded_impl! {
/// This impl requires the [`"rc"`] Cargo feature of Serde.
///
/// Deserializing a data structure containing `Rc` will not attempt to
/// deduplicate `Rc` references to the same data. Every deserialized `Rc`
/// will end up with a strong count of 1.
///
/// [`"rc"`]: https://serde.rs/feature-flags.html#-features-rc
(T), Rc<T>, Rc::new
}
#[cfg(any(feature = "std", feature = "alloc"))] #[cfg(any(feature = "std", feature = "alloc"))]
impl<'de, 'a, T: ?Sized> Deserialize<'de> for Cow<'a, T> impl<'de, 'a, T: ?Sized> Deserialize<'de> for Cow<'a, T>
where where
@ -1870,11 +1846,7 @@ where
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
#[cfg(all( #[cfg(all(feature = "rc", any(feature = "std", feature = "alloc")))]
not(no_de_rc_dst),
feature = "rc",
any(feature = "std", feature = "alloc")
))]
macro_rules! box_forwarded_impl { macro_rules! box_forwarded_impl {
( (
$(#[doc = $doc:tt])* $(#[doc = $doc:tt])*
@ -1895,11 +1867,7 @@ macro_rules! box_forwarded_impl {
}; };
} }
#[cfg(all( #[cfg(all(feature = "rc", any(feature = "std", feature = "alloc")))]
not(no_de_rc_dst),
feature = "rc",
any(feature = "std", feature = "alloc")
))]
box_forwarded_impl! { box_forwarded_impl! {
/// This impl requires the [`"rc"`] Cargo feature of Serde. /// This impl requires the [`"rc"`] Cargo feature of Serde.
/// ///
@ -1911,11 +1879,7 @@ box_forwarded_impl! {
Rc Rc
} }
#[cfg(all( #[cfg(all(feature = "rc", any(feature = "std", feature = "alloc")))]
not(no_de_rc_dst),
feature = "rc",
any(feature = "std", feature = "alloc")
))]
box_forwarded_impl! { box_forwarded_impl! {
/// This impl requires the [`"rc"`] Cargo feature of Serde. /// This impl requires the [`"rc"`] Cargo feature of Serde.
/// ///