diff options
author | Joel Galenson <jgalenson@google.com> | 2021-10-12 15:17:01 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2021-10-12 15:17:01 +0000 |
commit | e1c4d8be322b0599e939ce6e11fba5b443ce60d2 (patch) | |
tree | fab7f70aa7b3684fdd8aaada979d6c0f267ab159 | |
parent | 0aec792bedac08c26732ee0622572224eab5a011 (diff) | |
parent | 548c662c8c64f70b2dd69b068dbcce6a62aee2da (diff) | |
download | serde-e1c4d8be322b0599e939ce6e11fba5b443ce60d2.tar.gz |
Merge "Upgrade rust/crates/serde to 1.0.130" am: 11324cbe40 am: 548c662c8c
Original change: https://android-review.googlesource.com/c/platform/external/rust/crates/serde/+/1832703
Change-Id: I08461142702dd26dfbfae8abc4632307a172c206
-rw-r--r-- | .cargo_vcs_info.json | 2 | ||||
-rw-r--r-- | Android.bp | 10 | ||||
-rw-r--r-- | Cargo.toml | 4 | ||||
-rw-r--r-- | Cargo.toml.orig | 4 | ||||
-rw-r--r-- | METADATA | 8 | ||||
-rw-r--r-- | build.rs | 10 | ||||
-rw-r--r-- | src/de/mod.rs | 4 | ||||
-rw-r--r-- | src/lib.rs | 4 | ||||
-rw-r--r-- | src/private/mod.rs | 1 | ||||
-rw-r--r-- | src/ser/mod.rs | 30 |
10 files changed, 50 insertions, 27 deletions
diff --git a/.cargo_vcs_info.json b/.cargo_vcs_info.json index 9c11542..d722bd8 100644 --- a/.cargo_vcs_info.json +++ b/.cargo_vcs_info.json @@ -1,5 +1,5 @@ { "git": { - "sha1": "e2f85681fea9229208e83ae873c3a9a077f4d255" + "sha1": "65e1a50749938612cfbdb69b57fc4cf249f87149" } } @@ -42,6 +42,8 @@ rust_library { name: "libserde", host_supported: true, crate_name: "serde", + cargo_env_compat: true, + cargo_pkg_version: "1.0.130", srcs: ["src/lib.rs"], edition: "2015", features: [ @@ -58,6 +60,7 @@ rust_library { "de_boxed_path", "de_rc_dst", "integer128", + "iterator_try_fold", "num_nonzero", "num_nonzero_signed", "ops_bound", @@ -72,10 +75,3 @@ rust_library { "com.android.virt", ], } - -// dependent_library ["feature_list"] -// proc-macro2-1.0.28 "default,proc-macro" -// quote-1.0.9 "default,proc-macro" -// serde_derive-1.0.127 "default" -// syn-1.0.74 "clone-impls,default,derive,parsing,printing,proc-macro,quote" -// unicode-xid-0.2.2 "default" @@ -11,7 +11,7 @@ [package] name = "serde" -version = "1.0.127" +version = "1.0.130" authors = ["Erick Tryzelaar <erick.tryzelaar@gmail.com>", "David Tolnay <dtolnay@gmail.com>"] build = "build.rs" include = ["build.rs", "src/**/*.rs", "crates-io.md", "README.md", "LICENSE-APACHE", "LICENSE-MIT"] @@ -29,7 +29,7 @@ targets = ["x86_64-unknown-linux-gnu"] [package.metadata.playground] features = ["derive", "rc"] [dependencies.serde_derive] -version = "=1.0.127" +version = "=1.0.130" optional = true [dev-dependencies.serde_derive] version = "1.0" diff --git a/Cargo.toml.orig b/Cargo.toml.orig index 91e813b..7065d99 100644 --- a/Cargo.toml.orig +++ b/Cargo.toml.orig @@ -1,6 +1,6 @@ [package] name = "serde" -version = "1.0.127" # remember to update html_root_url and serde_derive dependency +version = "1.0.130" # remember to update html_root_url and serde_derive dependency authors = ["Erick Tryzelaar <erick.tryzelaar@gmail.com>", "David Tolnay <dtolnay@gmail.com>"] license = "MIT OR Apache-2.0" description = "A generic serialization/deserialization framework" @@ -14,7 +14,7 @@ include = ["build.rs", "src/**/*.rs", "crates-io.md", "README.md", "LICENSE-APAC build = "build.rs" [dependencies] -serde_derive = { version = "=1.0.127", optional = true, path = "../serde_derive" } +serde_derive = { version = "=1.0.130", optional = true, path = "../serde_derive" } [dev-dependencies] serde_derive = { version = "1.0", path = "../serde_derive" } @@ -7,13 +7,13 @@ third_party { } url { type: ARCHIVE - value: "https://static.crates.io/crates/serde/serde-1.0.127.crate" + value: "https://static.crates.io/crates/serde/serde-1.0.130.crate" } - version: "1.0.127" + version: "1.0.130" license_type: NOTICE last_upgrade_date { year: 2021 - month: 8 - day: 9 + month: 9 + day: 22 } } @@ -53,16 +53,20 @@ fn main() { // 128-bit integers stabilized in Rust 1.26: // https://blog.rust-lang.org/2018/05/10/Rust-1.26.html // - // Disabled on Emscripten targets as Emscripten doesn't - // currently support integers larger than 64 bits. - if minor >= 26 && !emscripten { + // Disabled on Emscripten targets before Rust 1.40 since + // Emscripten did not support 128-bit integers until Rust 1.40 + // (https://github.com/rust-lang/rust/pull/65251) + if minor >= 26 && (!emscripten || minor >= 40) { println!("cargo:rustc-cfg=integer128"); } // Inclusive ranges methods stabilized in Rust 1.27: // https://github.com/rust-lang/rust/pull/50758 + // Also Iterator::try_for_each: + // https://blog.rust-lang.org/2018/06/21/Rust-1.27.html#library-stabilizations if minor >= 27 { println!("cargo:rustc-cfg=range_inclusive"); + println!("cargo:rustc-cfg=iterator_try_fold"); } // Non-zero integers stabilized in Rust 1.28: diff --git a/src/de/mod.rs b/src/de/mod.rs index 86fc382..54e2fd6 100644 --- a/src/de/mod.rs +++ b/src/de/mod.rs @@ -1714,7 +1714,7 @@ pub trait SeqAccess<'de> { } } -impl<'de, 'a, A> SeqAccess<'de> for &'a mut A +impl<'de, 'a, A: ?Sized> SeqAccess<'de> for &'a mut A where A: SeqAccess<'de>, { @@ -1867,7 +1867,7 @@ pub trait MapAccess<'de> { } } -impl<'de, 'a, A> MapAccess<'de> for &'a mut A +impl<'de, 'a, A: ?Sized> MapAccess<'de> for &'a mut A where A: MapAccess<'de>, { @@ -84,7 +84,7 @@ //////////////////////////////////////////////////////////////////////////////// // Serde types in rustdoc of other crates get linked to here. -#![doc(html_root_url = "https://docs.rs/serde/1.0.127")] +#![doc(html_root_url = "https://docs.rs/serde/1.0.130")] // Support using Serde without the standard library! #![cfg_attr(not(feature = "std"), no_std)] // Unstable functionality only if the user asks for it. For tracking and @@ -157,7 +157,7 @@ mod lib { pub use std::*; } - pub use self::core::{cmp, iter, mem, num, slice, str}; + pub use self::core::{cmp, iter, mem, num, ptr, slice, str}; pub use self::core::{f32, f64}; pub use self::core::{i16, i32, i64, i8, isize}; pub use self::core::{u16, u32, u64, u8, usize}; diff --git a/src/private/mod.rs b/src/private/mod.rs index 24ea84b..71e82a8 100644 --- a/src/private/mod.rs +++ b/src/private/mod.rs @@ -14,6 +14,7 @@ pub use lib::default::Default; pub use lib::fmt::{self, Formatter}; pub use lib::marker::PhantomData; pub use lib::option::Option::{self, None, Some}; +pub use lib::ptr; pub use lib::result::Result::{self, Err, Ok}; pub use self::string::from_utf8_lossy; diff --git a/src/ser/mod.rs b/src/ser/mod.rs index d686c5a..d5bca09 100644 --- a/src/ser/mod.rs +++ b/src/ser/mod.rs @@ -1279,9 +1279,20 @@ pub trait Serializer: Sized { { let iter = iter.into_iter(); let mut serializer = try!(self.serialize_seq(iterator_len_hint(&iter))); - for item in iter { - try!(serializer.serialize_element(&item)); + + #[cfg(iterator_try_fold)] + { + let mut iter = iter; + try!(iter.try_for_each(|item| serializer.serialize_element(&item))); + } + + #[cfg(not(iterator_try_fold))] + { + for item in iter { + try!(serializer.serialize_element(&item)); + } } + serializer.end() } @@ -1319,9 +1330,20 @@ pub trait Serializer: Sized { { let iter = iter.into_iter(); let mut serializer = try!(self.serialize_map(iterator_len_hint(&iter))); - for (key, value) in iter { - try!(serializer.serialize_entry(&key, &value)); + + #[cfg(iterator_try_fold)] + { + let mut iter = iter; + try!(iter.try_for_each(|(key, value)| serializer.serialize_entry(&key, &value))); + } + + #[cfg(not(iterator_try_fold))] + { + for (key, value) in iter { + try!(serializer.serialize_entry(&key, &value)); + } } + serializer.end() } |