aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Galenson <jgalenson@google.com>2021-10-12 14:47:55 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2021-10-12 14:47:55 +0000
commit11324cbe40b00d80cd6dddb8f0fd2a629ec83a2b (patch)
treefab7f70aa7b3684fdd8aaada979d6c0f267ab159
parentef98984592bbc9c3f3fd77c7f2caac47773d29e4 (diff)
parentda48ce96b1cc061d46c06f888a21ca42ceed9482 (diff)
downloadserde-11324cbe40b00d80cd6dddb8f0fd2a629ec83a2b.tar.gz
Merge "Upgrade rust/crates/serde to 1.0.130"
-rw-r--r--.cargo_vcs_info.json2
-rw-r--r--Android.bp10
-rw-r--r--Cargo.toml4
-rw-r--r--Cargo.toml.orig4
-rw-r--r--METADATA8
-rw-r--r--build.rs10
-rw-r--r--src/de/mod.rs4
-rw-r--r--src/lib.rs4
-rw-r--r--src/private/mod.rs1
-rw-r--r--src/ser/mod.rs30
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"
}
}
diff --git a/Android.bp b/Android.bp
index a9a9523..ddeb344 100644
--- a/Android.bp
+++ b/Android.bp
@@ -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"
diff --git a/Cargo.toml b/Cargo.toml
index bda9d71..944be6b 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -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" }
diff --git a/METADATA b/METADATA
index cc1107c..a3ba416 100644
--- a/METADATA
+++ b/METADATA
@@ -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
}
}
diff --git a/build.rs b/build.rs
index afda291..52834bf 100644
--- a/build.rs
+++ b/build.rs
@@ -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>,
{
diff --git a/src/lib.rs b/src/lib.rs
index 1c09827..aad6851 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -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()
}