Roll serde: 1.0.210 => 1.0.213 in //third_party/rust.
This CL has been created semi-automatically. The expected review process and other details can be found at //tools/crates/create_update_cl.md Updated crates: * serde: 1.0.210 => 1.0.213 * serde_derive: 1.0.210 => 1.0.213 Chromium `supply-chain/config.toml` policy requires that the following audit criteria are met (note that these are the *minimum* required criteria and `supply-chain/audits.toml` can and should record a stricter certification if possible; see also //docs/rust-unsafe.md): * serde@1.0.213, serde_derive@1.0.213: crypto-safe, safe-to-deploy, ub-risk-2 Bug: None Change-Id: I71ffe401e4acfd9a02968c4559c4b35162de0377 Cq-Include-Trybots: chromium/try:android-rust-arm32-rel Cq-Include-Trybots: chromium/try:android-rust-arm64-dbg Cq-Include-Trybots: chromium/try:android-rust-arm64-rel Cq-Include-Trybots: chromium/try:linux-rust-x64-dbg Cq-Include-Trybots: chromium/try:linux-rust-x64-rel Cq-Include-Trybots: chromium/try:win-rust-x64-dbg Cq-Include-Trybots: chromium/try:win-rust-x64-rel Disable-Rts: True Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5962577 Commit-Queue: Liza Burakova <liza@chromium.org> Reviewed-by: Łukasz Anforowicz <lukasza@chromium.org> Cr-Commit-Position: refs/heads/main@{#1374644}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
6289508529
commit
54bc529212
infra
third_party/rust
chromium_crates_io
Cargo.lock
supply-chain
vendor
serde-1.0.210
serde-1.0.213
.cargo-checksum.json.cargo_vcs_info.jsonCargo.tomlCargo.toml.origLICENSE-APACHELICENSE-MITREADME.mdbuild.rscrates-io.md
src
serde_derive-1.0.210
serde_derive-1.0.213
serde
serde_derive
@ -712,9 +712,9 @@ third_party/rust/chromium_crates_io/vendor/ryu-1.0.18/.github/workflows 2 1
|
||||
third_party/rust/chromium_crates_io/vendor/ryu-1.0.18/src 1 1
|
||||
third_party/rust/chromium_crates_io/vendor/semver-1.0.23 1 1
|
||||
third_party/rust/chromium_crates_io/vendor/semver-1.0.23/.github/workflows 2 1
|
||||
third_party/rust/chromium_crates_io/vendor/serde-1.0.210 1 1
|
||||
third_party/rust/chromium_crates_io/vendor/serde-1.0.210/src 1 1
|
||||
third_party/rust/chromium_crates_io/vendor/serde_derive-1.0.210 1 1
|
||||
third_party/rust/chromium_crates_io/vendor/serde-1.0.213 1 1
|
||||
third_party/rust/chromium_crates_io/vendor/serde-1.0.213/src 1 1
|
||||
third_party/rust/chromium_crates_io/vendor/serde_derive-1.0.213 1 1
|
||||
third_party/rust/chromium_crates_io/vendor/serde_json-1.0.132 6 1
|
||||
third_party/rust/chromium_crates_io/vendor/serde_json-1.0.132/.github/workflows 1 1
|
||||
third_party/rust/chromium_crates_io/vendor/serde_json_lenient-0.2.1 1 1
|
||||
|
4
third_party/rust/chromium_crates_io/Cargo.lock
generated
vendored
4
third_party/rust/chromium_crates_io/Cargo.lock
generated
vendored
@ -547,7 +547,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
version = "1.0.210"
|
||||
version = "1.0.213"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"serde_derive",
|
||||
@ -555,7 +555,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "serde_derive"
|
||||
version = "1.0.210"
|
||||
version = "1.0.213"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
|
@ -1976,6 +1976,11 @@ criteria = ["safe-to-deploy", "does-not-implement-crypto", "ub-risk-2"]
|
||||
delta = "1.0.209 -> 1.0.210"
|
||||
notes = "Almost no new code - just feature rearrangement"
|
||||
|
||||
[[audits.serde]]
|
||||
who = "Liza Burakova <liza@chromium.org>"
|
||||
criteria = ["safe-to-deploy", "does-not-implement-crypto", "ub-risk-2"]
|
||||
delta = "1.0.210 -> 1.0.213"
|
||||
|
||||
[[audits.serde_derive]]
|
||||
who = "Lukasz Anforowicz <lukasza@chromium.org>"
|
||||
criteria = "ub-risk-0"
|
||||
@ -2044,6 +2049,12 @@ criteria = ["safe-to-deploy", "does-not-implement-crypto", "ub-risk-0"]
|
||||
delta = "1.0.209 -> 1.0.210"
|
||||
notes = "Almost no new code - just feature rearrangement"
|
||||
|
||||
[[audits.serde_derive]]
|
||||
who = "Liza Burakova <liza@chromium.org>"
|
||||
criteria = ["safe-to-deploy", "does-not-implement-crypto", "ub-risk-0"]
|
||||
delta = "1.0.210 -> 1.0.213"
|
||||
notes = "Grepped for 'unsafe', 'crypt', 'cipher', 'fs', 'net' - there were no hits"
|
||||
|
||||
[[audits.serde_json]]
|
||||
who = "danakj@chromium.org"
|
||||
criteria = ["safe-to-run", "does-not-implement-crypto"]
|
||||
|
@ -242,10 +242,10 @@ criteria = ["crypto-safe", "safe-to-deploy", "ub-risk-2"]
|
||||
[policy."semver:1.0.23"]
|
||||
criteria = ["crypto-safe", "safe-to-run"]
|
||||
|
||||
[policy."serde:1.0.210"]
|
||||
[policy."serde:1.0.213"]
|
||||
criteria = ["crypto-safe", "safe-to-deploy", "ub-risk-2"]
|
||||
|
||||
[policy."serde_derive:1.0.210"]
|
||||
[policy."serde_derive:1.0.213"]
|
||||
criteria = ["crypto-safe", "safe-to-deploy", "ub-risk-2"]
|
||||
|
||||
[policy."serde_json:1.0.132"]
|
||||
|
@ -1,6 +0,0 @@
|
||||
{
|
||||
"git": {
|
||||
"sha1": "89c4b02bf32ceae5b17d89f93a452ccc195ca038"
|
||||
},
|
||||
"path_in_vcs": "serde"
|
||||
}
|
6
third_party/rust/chromium_crates_io/vendor/serde-1.0.213/.cargo_vcs_info.json
vendored
Normal file
6
third_party/rust/chromium_crates_io/vendor/serde-1.0.213/.cargo_vcs_info.json
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"git": {
|
||||
"sha1": "58a8d229315553c4ae0a8d7eee8e382fbae4b4bf"
|
||||
},
|
||||
"path_in_vcs": "serde"
|
||||
}
|
@ -13,12 +13,13 @@
|
||||
edition = "2018"
|
||||
rust-version = "1.31"
|
||||
name = "serde"
|
||||
version = "1.0.210"
|
||||
version = "1.0.213"
|
||||
authors = [
|
||||
"Erick Tryzelaar <erick.tryzelaar@gmail.com>",
|
||||
"David Tolnay <dtolnay@gmail.com>",
|
||||
]
|
||||
build = "build.rs"
|
||||
autolib = false
|
||||
autobins = false
|
||||
autoexamples = false
|
||||
autotests = false
|
||||
@ -76,4 +77,4 @@ std = []
|
||||
unstable = []
|
||||
|
||||
[target."cfg(any())".dependencies.serde_derive]
|
||||
version = "=1.0.210"
|
||||
version = "=1.0.213"
|
4
third_party/rust/chromium_crates_io/vendor/serde-1.0.210/Cargo.toml.orig → third_party/rust/chromium_crates_io/vendor/serde-1.0.213/Cargo.toml.orig
generated
vendored
4
third_party/rust/chromium_crates_io/vendor/serde-1.0.210/Cargo.toml.orig → third_party/rust/chromium_crates_io/vendor/serde-1.0.213/Cargo.toml.orig
generated
vendored
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "serde"
|
||||
version = "1.0.210"
|
||||
version = "1.0.213"
|
||||
authors = ["Erick Tryzelaar <erick.tryzelaar@gmail.com>", "David Tolnay <dtolnay@gmail.com>"]
|
||||
build = "build.rs"
|
||||
categories = ["encoding", "no-std", "no-std::no-alloc"]
|
||||
@ -37,7 +37,7 @@ rustdoc-args = ["--generate-link-to-definition"]
|
||||
# is compatible with exactly one serde release because the generated code
|
||||
# involves nonpublic APIs which are not bound by semver.
|
||||
[target.'cfg(any())'.dependencies]
|
||||
serde_derive = { version = "=1.0.210", path = "../serde_derive" }
|
||||
serde_derive = { version = "=1.0.213", path = "../serde_derive" }
|
||||
|
||||
|
||||
### FEATURES #################################################################
|
@ -1,4 +1,4 @@
|
||||
# Serde   [![Build Status]][actions] [![Latest Version]][crates.io] [![serde msrv]][Rust 1.31] [![serde_derive msrv]][Rust 1.56]
|
||||
# Serde   [![Build Status]][actions] [![Latest Version]][crates.io] [![serde msrv]][Rust 1.31] [![serde_derive msrv]][Rust 1.61]
|
||||
|
||||
[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
|
||||
@ -7,7 +7,7 @@
|
||||
[serde msrv]: https://img.shields.io/crates/msrv/serde.svg?label=serde%20msrv&color=lightgray
|
||||
[serde_derive msrv]: https://img.shields.io/crates/msrv/serde_derive.svg?label=serde_derive%20msrv&color=lightgray
|
||||
[Rust 1.31]: https://blog.rust-lang.org/2018/12/06/Rust-1.31-and-rust-2018.html
|
||||
[Rust 1.56]: https://blog.rust-lang.org/2021/10/21/Rust-1.56.0.html
|
||||
[Rust 1.61]: https://blog.rust-lang.org/2022/05/19/Rust-1.61.0.html
|
||||
|
||||
**Serde is a framework for *ser*ializing and *de*serializing Rust data structures efficiently and generically.**
|
||||
|
@ -50,11 +50,6 @@ fn main() {
|
||||
println!("cargo:rustc-cfg=no_float_copysign");
|
||||
}
|
||||
|
||||
// Current minimum supported version of serde_derive crate is Rust 1.56.
|
||||
if minor < 56 {
|
||||
println!("cargo:rustc-cfg=no_serde_derive");
|
||||
}
|
||||
|
||||
// Support for #[cfg(target_has_atomic = "...")] stabilized in Rust 1.60.
|
||||
if minor < 60 {
|
||||
println!("cargo:rustc-cfg=no_target_has_atomic");
|
||||
@ -76,6 +71,11 @@ fn main() {
|
||||
}
|
||||
}
|
||||
|
||||
// Current minimum supported version of serde_derive crate is Rust 1.61.
|
||||
if minor < 61 {
|
||||
println!("cargo:rustc-cfg=no_serde_derive");
|
||||
}
|
||||
|
||||
// Support for core::ffi::CStr and alloc::ffi::CString stabilized in Rust 1.64.
|
||||
// https://blog.rust-lang.org/2022/09/22/Rust-1.64.0.html#c-compatible-ffi-types-in-core-and-alloc
|
||||
if minor < 64 {
|
@ -486,13 +486,13 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Expected for &'a str {
|
||||
impl Expected for &str {
|
||||
fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
|
||||
formatter.write_str(self)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Display for Expected + 'a {
|
||||
impl Display for Expected + '_ {
|
||||
fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
|
||||
Expected::fmt(self, formatter)
|
||||
}
|
||||
@ -1741,7 +1741,7 @@ pub trait SeqAccess<'de> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'de, 'a, A> SeqAccess<'de> for &'a mut A
|
||||
impl<'de, A> SeqAccess<'de> for &mut A
|
||||
where
|
||||
A: ?Sized + SeqAccess<'de>,
|
||||
{
|
||||
@ -1894,7 +1894,7 @@ pub trait MapAccess<'de> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'de, 'a, A> MapAccess<'de> for &'a mut A
|
||||
impl<'de, A> MapAccess<'de> for &mut A
|
||||
where
|
||||
A: ?Sized + MapAccess<'de>,
|
||||
{
|
@ -95,7 +95,7 @@
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// Serde types in rustdoc of other crates get linked to here.
|
||||
#![doc(html_root_url = "https://docs.rs/serde/1.0.210")]
|
||||
#![doc(html_root_url = "https://docs.rs/serde/1.0.213")]
|
||||
// Support using Serde without the standard library!
|
||||
#![cfg_attr(not(feature = "std"), no_std)]
|
||||
// Show which crate feature enables conditionally compiled APIs in documentation.
|
||||
@ -144,6 +144,7 @@
|
||||
clippy::too_many_lines,
|
||||
// preference
|
||||
clippy::doc_markdown,
|
||||
clippy::needless_lifetimes,
|
||||
clippy::unseparated_literal_suffix,
|
||||
// false positive
|
||||
clippy::needless_doctest_main,
|
@ -313,6 +313,17 @@ mod content {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, 'de, E> de::IntoDeserializer<'de, E> for &'a Content<'de>
|
||||
where
|
||||
E: de::Error,
|
||||
{
|
||||
type Deserializer = ContentRefDeserializer<'a, 'de, E>;
|
||||
|
||||
fn into_deserializer(self) -> Self::Deserializer {
|
||||
ContentRefDeserializer::new(self)
|
||||
}
|
||||
}
|
||||
|
||||
/// Used to capture data in [`Content`] from other deserializers.
|
||||
/// Cannot capture externally tagged enums, `i128` and `u128`.
|
||||
struct ContentVisitor<'de> {
|
||||
@ -476,14 +487,16 @@ mod content {
|
||||
where
|
||||
D: Deserializer<'de>,
|
||||
{
|
||||
Deserialize::deserialize(deserializer).map(|v| Content::Some(Box::new(v)))
|
||||
let v = tri!(Deserialize::deserialize(deserializer));
|
||||
Ok(Content::Some(Box::new(v)))
|
||||
}
|
||||
|
||||
fn visit_newtype_struct<D>(self, deserializer: D) -> Result<Self::Value, D::Error>
|
||||
where
|
||||
D: Deserializer<'de>,
|
||||
{
|
||||
Deserialize::deserialize(deserializer).map(|v| Content::Newtype(Box::new(v)))
|
||||
let v = tri!(Deserialize::deserialize(deserializer));
|
||||
Ok(Content::Newtype(Box::new(v)))
|
||||
}
|
||||
|
||||
fn visit_seq<V>(self, mut visitor: V) -> Result<Self::Value, V::Error>
|
||||
@ -1098,8 +1111,7 @@ mod content {
|
||||
V: Visitor<'de>,
|
||||
E: de::Error,
|
||||
{
|
||||
let seq = content.into_iter().map(ContentDeserializer::new);
|
||||
let mut seq_visitor = SeqDeserializer::new(seq);
|
||||
let mut seq_visitor = SeqDeserializer::new(content.into_iter());
|
||||
let value = tri!(visitor.visit_seq(&mut seq_visitor));
|
||||
tri!(seq_visitor.end());
|
||||
Ok(value)
|
||||
@ -1113,10 +1125,7 @@ mod content {
|
||||
V: Visitor<'de>,
|
||||
E: de::Error,
|
||||
{
|
||||
let map = content
|
||||
.into_iter()
|
||||
.map(|(k, v)| (ContentDeserializer::new(k), ContentDeserializer::new(v)));
|
||||
let mut map_visitor = MapDeserializer::new(map);
|
||||
let mut map_visitor = MapDeserializer::new(content.into_iter());
|
||||
let value = tri!(visitor.visit_map(&mut map_visitor));
|
||||
tri!(map_visitor.end());
|
||||
Ok(value)
|
||||
@ -1694,8 +1703,7 @@ mod content {
|
||||
V: Visitor<'de>,
|
||||
E: de::Error,
|
||||
{
|
||||
let seq = content.iter().map(ContentRefDeserializer::new);
|
||||
let mut seq_visitor = SeqDeserializer::new(seq);
|
||||
let mut seq_visitor = SeqDeserializer::new(content.iter());
|
||||
let value = tri!(visitor.visit_seq(&mut seq_visitor));
|
||||
tri!(seq_visitor.end());
|
||||
Ok(value)
|
||||
@ -1709,12 +1717,13 @@ mod content {
|
||||
V: Visitor<'de>,
|
||||
E: de::Error,
|
||||
{
|
||||
let map = content.iter().map(|(k, v)| {
|
||||
(
|
||||
ContentRefDeserializer::new(k),
|
||||
ContentRefDeserializer::new(v),
|
||||
)
|
||||
});
|
||||
fn content_ref_deserializer_pair<'a, 'de>(
|
||||
(k, v): &'a (Content<'de>, Content<'de>),
|
||||
) -> (&'a Content<'de>, &'a Content<'de>) {
|
||||
(k, v)
|
||||
}
|
||||
|
||||
let map = content.iter().map(content_ref_deserializer_pair);
|
||||
let mut map_visitor = MapDeserializer::new(map);
|
||||
let value = tri!(visitor.visit_map(&mut map_visitor));
|
||||
tri!(map_visitor.end());
|
@ -35,7 +35,7 @@ macro_rules! fmt_primitives {
|
||||
/// }
|
||||
/// }
|
||||
/// ```
|
||||
impl<'a, 'b> Serializer for &'a mut fmt::Formatter<'b> {
|
||||
impl<'a> Serializer for &mut fmt::Formatter<'a> {
|
||||
type Ok = ();
|
||||
type Error = fmt::Error;
|
||||
type SerializeSeq = Impossible<(), fmt::Error>;
|
@ -1,6 +0,0 @@
|
||||
{
|
||||
"git": {
|
||||
"sha1": "89c4b02bf32ceae5b17d89f93a452ccc195ca038"
|
||||
},
|
||||
"path_in_vcs": "serde_derive"
|
||||
}
|
6
third_party/rust/chromium_crates_io/vendor/serde_derive-1.0.213/.cargo_vcs_info.json
vendored
Normal file
6
third_party/rust/chromium_crates_io/vendor/serde_derive-1.0.213/.cargo_vcs_info.json
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"git": {
|
||||
"sha1": "58a8d229315553c4ae0a8d7eee8e382fbae4b4bf"
|
||||
},
|
||||
"path_in_vcs": "serde_derive"
|
||||
}
|
@ -11,15 +11,16 @@
|
||||
|
||||
[package]
|
||||
edition = "2015"
|
||||
rust-version = "1.56"
|
||||
rust-version = "1.61"
|
||||
name = "serde_derive"
|
||||
version = "1.0.210"
|
||||
version = "1.0.213"
|
||||
authors = [
|
||||
"Erick Tryzelaar <erick.tryzelaar@gmail.com>",
|
||||
"David Tolnay <dtolnay@gmail.com>",
|
||||
]
|
||||
build = false
|
||||
exclude = ["build.rs"]
|
||||
autolib = false
|
||||
autobins = false
|
||||
autoexamples = false
|
||||
autotests = false
|
||||
@ -61,7 +62,7 @@ features = ["proc-macro"]
|
||||
default-features = false
|
||||
|
||||
[dependencies.syn]
|
||||
version = "2.0.46"
|
||||
version = "2.0.81"
|
||||
features = [
|
||||
"clone-impls",
|
||||
"derive",
|
4
third_party/rust/chromium_crates_io/vendor/serde_derive-1.0.210/Cargo.toml.orig → third_party/rust/chromium_crates_io/vendor/serde_derive-1.0.213/Cargo.toml.orig
generated
vendored
4
third_party/rust/chromium_crates_io/vendor/serde_derive-1.0.210/Cargo.toml.orig → third_party/rust/chromium_crates_io/vendor/serde_derive-1.0.213/Cargo.toml.orig
generated
vendored
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "serde_derive"
|
||||
version = "1.0.210"
|
||||
version = "1.0.213"
|
||||
authors = ["Erick Tryzelaar <erick.tryzelaar@gmail.com>", "David Tolnay <dtolnay@gmail.com>"]
|
||||
categories = ["no-std", "no-std::no-alloc"]
|
||||
description = "Macros 1.1 implementation of #[derive(Serialize, Deserialize)]"
|
||||
@ -12,7 +12,7 @@ keywords = ["serde", "serialization", "no_std", "derive"]
|
||||
license = "MIT OR Apache-2.0"
|
||||
readme = "crates-io.md"
|
||||
repository = "https://github.com/serde-rs/serde"
|
||||
rust-version = "1.56"
|
||||
rust-version = "1.61"
|
||||
|
||||
[features]
|
||||
default = []
|
@ -1,4 +1,4 @@
|
||||
# Serde   [![Build Status]][actions] [![Latest Version]][crates.io] [![serde msrv]][Rust 1.31] [![serde_derive msrv]][Rust 1.56]
|
||||
# Serde   [![Build Status]][actions] [![Latest Version]][crates.io] [![serde msrv]][Rust 1.31] [![serde_derive msrv]][Rust 1.61]
|
||||
|
||||
[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
|
||||
@ -7,7 +7,7 @@
|
||||
[serde msrv]: https://img.shields.io/crates/msrv/serde.svg?label=serde%20msrv&color=lightgray
|
||||
[serde_derive msrv]: https://img.shields.io/crates/msrv/serde_derive.svg?label=serde_derive%20msrv&color=lightgray
|
||||
[Rust 1.31]: https://blog.rust-lang.org/2018/12/06/Rust-1.31-and-rust-2018.html
|
||||
[Rust 1.56]: https://blog.rust-lang.org/2021/10/21/Rust-1.56.0.html
|
||||
[Rust 1.61]: https://blog.rust-lang.org/2022/05/19/Rust-1.61.0.html
|
||||
|
||||
**Serde is a framework for *ser*ializing and *de*serializing Rust data structures efficiently and generically.**
|
||||
|
@ -227,7 +227,9 @@ pub fn with_bound(
|
||||
match bound {
|
||||
#![cfg_attr(all(test, exhaustive), deny(non_exhaustive_omitted_patterns))]
|
||||
syn::TypeParamBound::Trait(bound) => self.visit_path(&bound.path),
|
||||
syn::TypeParamBound::Lifetime(_) | syn::TypeParamBound::Verbatim(_) => {}
|
||||
syn::TypeParamBound::Lifetime(_)
|
||||
| syn::TypeParamBound::PreciseCapture(_)
|
||||
| syn::TypeParamBound::Verbatim(_) => {}
|
||||
_ => {}
|
||||
}
|
||||
}
|
@ -371,7 +371,11 @@ fn deserialize_transparent(cont: &Container, params: &Parameters) -> Fragment {
|
||||
} else {
|
||||
let value = match field.attrs.default() {
|
||||
attr::Default::Default => quote!(_serde::__private::Default::default()),
|
||||
attr::Default::Path(path) => quote!(#path()),
|
||||
// If #path returns wrong type, error will be reported here (^^^^^).
|
||||
// We attach span of the path to the function so it will be reported
|
||||
// on the #[serde(default = "...")]
|
||||
// ^^^^^
|
||||
attr::Default::Path(path) => quote_spanned!(path.span()=> #path()),
|
||||
attr::Default::None => quote!(_serde::__private::PhantomData),
|
||||
};
|
||||
quote!(#member: #value)
|
||||
@ -757,7 +761,11 @@ fn deserialize_seq(
|
||||
attr::Default::Default => Some(quote!(
|
||||
let __default: Self::Value = _serde::__private::Default::default();
|
||||
)),
|
||||
attr::Default::Path(path) => Some(quote!(
|
||||
// If #path returns wrong type, error will be reported here (^^^^^).
|
||||
// We attach span of the path to the function so it will be reported
|
||||
// on the #[serde(default = "...")]
|
||||
// ^^^^^
|
||||
attr::Default::Path(path) => Some(quote_spanned!(path.span()=>
|
||||
let __default: Self::Value = #path();
|
||||
)),
|
||||
attr::Default::None => {
|
||||
@ -839,7 +847,11 @@ fn deserialize_seq_in_place(
|
||||
attr::Default::Default => Some(quote!(
|
||||
let __default: #this_type #ty_generics = _serde::__private::Default::default();
|
||||
)),
|
||||
attr::Default::Path(path) => Some(quote!(
|
||||
// If #path returns wrong type, error will be reported here (^^^^^).
|
||||
// We attach span of the path to the function so it will be reported
|
||||
// on the #[serde(default = "...")]
|
||||
// ^^^^^
|
||||
attr::Default::Path(path) => Some(quote_spanned!(path.span()=>
|
||||
let __default: #this_type #ty_generics = #path();
|
||||
)),
|
||||
attr::Default::None => {
|
||||
@ -863,18 +875,23 @@ fn deserialize_newtype_struct(
|
||||
) -> TokenStream {
|
||||
let delife = params.borrowed.de_lifetime();
|
||||
let field_ty = field.ty;
|
||||
let deserializer_var = quote!(__e);
|
||||
|
||||
let value = match field.attrs.deserialize_with() {
|
||||
None => {
|
||||
let span = field.original.span();
|
||||
let func = quote_spanned!(span=> <#field_ty as _serde::Deserialize>::deserialize);
|
||||
quote! {
|
||||
#func(__e)?
|
||||
#func(#deserializer_var)?
|
||||
}
|
||||
}
|
||||
Some(path) => {
|
||||
quote! {
|
||||
#path(__e)?
|
||||
// If #path returns wrong type, error will be reported here (^^^^^).
|
||||
// We attach span of the path to the function so it will be reported
|
||||
// on the #[serde(with = "...")]
|
||||
// ^^^^^
|
||||
quote_spanned! {path.span()=>
|
||||
#path(#deserializer_var)?
|
||||
}
|
||||
}
|
||||
};
|
||||
@ -890,7 +907,7 @@ fn deserialize_newtype_struct(
|
||||
|
||||
quote! {
|
||||
#[inline]
|
||||
fn visit_newtype_struct<__E>(self, __e: __E) -> _serde::__private::Result<Self::Value, __E::Error>
|
||||
fn visit_newtype_struct<__E>(self, #deserializer_var: __E) -> _serde::__private::Result<Self::Value, __E::Error>
|
||||
where
|
||||
__E: _serde::Deserializer<#delife>,
|
||||
{
|
||||
@ -950,23 +967,20 @@ fn deserialize_struct(
|
||||
};
|
||||
let expecting = cattrs.expecting().unwrap_or(&expecting);
|
||||
|
||||
let field_names_idents: Vec<_> = fields
|
||||
let deserialized_fields: Vec<_> = fields
|
||||
.iter()
|
||||
.enumerate()
|
||||
// Skip fields that shouldn't be deserialized or that were flattened,
|
||||
// so they don't appear in the storage in their literal form
|
||||
.filter(|&(_, field)| !field.attrs.skip_deserializing() && !field.attrs.flatten())
|
||||
.map(|(i, field)| {
|
||||
(
|
||||
field.attrs.name().deserialize_name(),
|
||||
field_i(i),
|
||||
field.attrs.aliases(),
|
||||
)
|
||||
.map(|(i, field)| FieldWithAliases {
|
||||
ident: field_i(i),
|
||||
aliases: field.attrs.aliases(),
|
||||
})
|
||||
.collect();
|
||||
|
||||
let has_flatten = has_flatten(fields);
|
||||
let field_visitor = deserialize_field_identifier(&field_names_idents, cattrs, has_flatten);
|
||||
let field_visitor = deserialize_field_identifier(&deserialized_fields, cattrs, has_flatten);
|
||||
|
||||
// untagged struct variants do not get a visit_seq method. The same applies to
|
||||
// structs that only have a map representation.
|
||||
@ -974,7 +988,7 @@ fn deserialize_struct(
|
||||
StructForm::Untagged(..) => None,
|
||||
_ if has_flatten => None,
|
||||
_ => {
|
||||
let mut_seq = if field_names_idents.is_empty() {
|
||||
let mut_seq = if deserialized_fields.is_empty() {
|
||||
quote!(_)
|
||||
} else {
|
||||
quote!(mut __seq)
|
||||
@ -1022,9 +1036,7 @@ fn deserialize_struct(
|
||||
let fields_stmt = if has_flatten {
|
||||
None
|
||||
} else {
|
||||
let field_names = field_names_idents
|
||||
.iter()
|
||||
.flat_map(|&(_, _, aliases)| aliases);
|
||||
let field_names = deserialized_fields.iter().flat_map(|field| field.aliases);
|
||||
|
||||
Some(quote! {
|
||||
#[doc(hidden)]
|
||||
@ -1117,31 +1129,26 @@ fn deserialize_struct_in_place(
|
||||
let expecting = format!("struct {}", params.type_name());
|
||||
let expecting = cattrs.expecting().unwrap_or(&expecting);
|
||||
|
||||
let field_names_idents: Vec<_> = fields
|
||||
let deserialized_fields: Vec<_> = fields
|
||||
.iter()
|
||||
.enumerate()
|
||||
.filter(|&(_, field)| !field.attrs.skip_deserializing())
|
||||
.map(|(i, field)| {
|
||||
(
|
||||
field.attrs.name().deserialize_name(),
|
||||
field_i(i),
|
||||
field.attrs.aliases(),
|
||||
)
|
||||
.map(|(i, field)| FieldWithAliases {
|
||||
ident: field_i(i),
|
||||
aliases: field.attrs.aliases(),
|
||||
})
|
||||
.collect();
|
||||
|
||||
let field_visitor = deserialize_field_identifier(&field_names_idents, cattrs, false);
|
||||
let field_visitor = deserialize_field_identifier(&deserialized_fields, cattrs, false);
|
||||
|
||||
let mut_seq = if field_names_idents.is_empty() {
|
||||
let mut_seq = if deserialized_fields.is_empty() {
|
||||
quote!(_)
|
||||
} else {
|
||||
quote!(mut __seq)
|
||||
};
|
||||
let visit_seq = Stmts(deserialize_seq_in_place(params, fields, cattrs, expecting));
|
||||
let visit_map = Stmts(deserialize_map_in_place(params, fields, cattrs));
|
||||
let field_names = field_names_idents
|
||||
.iter()
|
||||
.flat_map(|&(_, _, aliases)| aliases);
|
||||
let field_names = deserialized_fields.iter().flat_map(|field| field.aliases);
|
||||
let type_name = cattrs.name().deserialize_name();
|
||||
|
||||
let in_place_impl_generics = de_impl_generics.in_place();
|
||||
@ -1225,39 +1232,38 @@ fn deserialize_homogeneous_enum(
|
||||
}
|
||||
|
||||
fn prepare_enum_variant_enum(variants: &[Variant]) -> (TokenStream, Stmts) {
|
||||
let mut deserialized_variants = variants
|
||||
let deserialized_variants = variants
|
||||
.iter()
|
||||
.enumerate()
|
||||
.filter(|&(_, variant)| !variant.attrs.skip_deserializing());
|
||||
|
||||
let variant_names_idents: Vec<_> = deserialized_variants
|
||||
.clone()
|
||||
.map(|(i, variant)| {
|
||||
(
|
||||
variant.attrs.name().deserialize_name(),
|
||||
field_i(i),
|
||||
variant.attrs.aliases(),
|
||||
)
|
||||
})
|
||||
.collect();
|
||||
.filter(|&(_i, variant)| !variant.attrs.skip_deserializing());
|
||||
|
||||
let fallthrough = deserialized_variants
|
||||
.position(|(_, variant)| variant.attrs.other())
|
||||
.map(|other_idx| {
|
||||
let ignore_variant = variant_names_idents[other_idx].1.clone();
|
||||
.clone()
|
||||
.find(|(_i, variant)| variant.attrs.other())
|
||||
.map(|(i, _variant)| {
|
||||
let ignore_variant = field_i(i);
|
||||
quote!(_serde::__private::Ok(__Field::#ignore_variant))
|
||||
});
|
||||
|
||||
let variants_stmt = {
|
||||
let variant_names = variant_names_idents.iter().map(|(name, _, _)| name);
|
||||
let variant_names = deserialized_variants
|
||||
.clone()
|
||||
.flat_map(|(_i, variant)| variant.attrs.aliases());
|
||||
quote! {
|
||||
#[doc(hidden)]
|
||||
const VARIANTS: &'static [&'static str] = &[ #(#variant_names),* ];
|
||||
}
|
||||
};
|
||||
|
||||
let deserialized_variants: Vec<_> = deserialized_variants
|
||||
.map(|(i, variant)| FieldWithAliases {
|
||||
ident: field_i(i),
|
||||
aliases: variant.attrs.aliases(),
|
||||
})
|
||||
.collect();
|
||||
|
||||
let variant_visitor = Stmts(deserialize_generated_identifier(
|
||||
&variant_names_idents,
|
||||
&deserialized_variants,
|
||||
false, // variant identifiers do not depend on the presence of flatten fields
|
||||
true,
|
||||
None,
|
||||
@ -1994,19 +2000,27 @@ fn deserialize_untagged_newtype_variant(
|
||||
}
|
||||
}
|
||||
|
||||
struct FieldWithAliases<'a> {
|
||||
ident: Ident,
|
||||
aliases: &'a BTreeSet<String>,
|
||||
}
|
||||
|
||||
fn deserialize_generated_identifier(
|
||||
fields: &[(&str, Ident, &BTreeSet<String>)],
|
||||
deserialized_fields: &[FieldWithAliases],
|
||||
has_flatten: bool,
|
||||
is_variant: bool,
|
||||
ignore_variant: Option<TokenStream>,
|
||||
fallthrough: Option<TokenStream>,
|
||||
) -> Fragment {
|
||||
let this_value = quote!(__Field);
|
||||
let field_idents: &Vec<_> = &fields.iter().map(|(_, ident, _)| ident).collect();
|
||||
let field_idents: &Vec<_> = &deserialized_fields
|
||||
.iter()
|
||||
.map(|field| &field.ident)
|
||||
.collect();
|
||||
|
||||
let visitor_impl = Stmts(deserialize_identifier(
|
||||
&this_value,
|
||||
fields,
|
||||
deserialized_fields,
|
||||
is_variant,
|
||||
fallthrough,
|
||||
None,
|
||||
@ -2052,7 +2066,7 @@ fn deserialize_generated_identifier(
|
||||
/// Generates enum and its `Deserialize` implementation that represents each
|
||||
/// non-skipped field of the struct
|
||||
fn deserialize_field_identifier(
|
||||
fields: &[(&str, Ident, &BTreeSet<String>)],
|
||||
deserialized_fields: &[FieldWithAliases],
|
||||
cattrs: &attr::Container,
|
||||
has_flatten: bool,
|
||||
) -> Stmts {
|
||||
@ -2069,7 +2083,7 @@ fn deserialize_field_identifier(
|
||||
};
|
||||
|
||||
Stmts(deserialize_generated_identifier(
|
||||
fields,
|
||||
deserialized_fields,
|
||||
has_flatten,
|
||||
false,
|
||||
ignore_variant,
|
||||
@ -2127,18 +2141,15 @@ fn deserialize_custom_identifier(
|
||||
(variants, None, None)
|
||||
};
|
||||
|
||||
let names_idents: Vec<_> = ordinary
|
||||
let idents_aliases: Vec<_> = ordinary
|
||||
.iter()
|
||||
.map(|variant| {
|
||||
(
|
||||
variant.attrs.name().deserialize_name(),
|
||||
variant.ident.clone(),
|
||||
variant.attrs.aliases(),
|
||||
)
|
||||
.map(|variant| FieldWithAliases {
|
||||
ident: variant.ident.clone(),
|
||||
aliases: variant.attrs.aliases(),
|
||||
})
|
||||
.collect();
|
||||
|
||||
let names = names_idents.iter().flat_map(|&(_, _, aliases)| aliases);
|
||||
let names = idents_aliases.iter().flat_map(|variant| variant.aliases);
|
||||
|
||||
let names_const = if fallthrough.is_some() {
|
||||
None
|
||||
@ -2161,7 +2172,7 @@ fn deserialize_custom_identifier(
|
||||
let delife = params.borrowed.de_lifetime();
|
||||
let visitor_impl = Stmts(deserialize_identifier(
|
||||
&this_value,
|
||||
&names_idents,
|
||||
&idents_aliases,
|
||||
is_variant,
|
||||
fallthrough,
|
||||
fallthrough_borrowed,
|
||||
@ -2194,20 +2205,24 @@ fn deserialize_custom_identifier(
|
||||
|
||||
fn deserialize_identifier(
|
||||
this_value: &TokenStream,
|
||||
fields: &[(&str, Ident, &BTreeSet<String>)],
|
||||
deserialized_fields: &[FieldWithAliases],
|
||||
is_variant: bool,
|
||||
fallthrough: Option<TokenStream>,
|
||||
fallthrough_borrowed: Option<TokenStream>,
|
||||
collect_other_fields: bool,
|
||||
expecting: Option<&str>,
|
||||
) -> Fragment {
|
||||
let str_mapping = fields.iter().map(|(_, ident, aliases)| {
|
||||
let str_mapping = deserialized_fields.iter().map(|field| {
|
||||
let ident = &field.ident;
|
||||
let aliases = field.aliases;
|
||||
// `aliases` also contains a main name
|
||||
quote!(#(#aliases)|* => _serde::__private::Ok(#this_value::#ident))
|
||||
});
|
||||
let bytes_mapping = fields.iter().map(|(_, ident, aliases)| {
|
||||
let bytes_mapping = deserialized_fields.iter().map(|field| {
|
||||
let ident = &field.ident;
|
||||
// `aliases` also contains a main name
|
||||
let aliases = aliases
|
||||
let aliases = field
|
||||
.aliases
|
||||
.iter()
|
||||
.map(|alias| Literal::byte_string(alias.as_bytes()));
|
||||
quote!(#(#aliases)|* => _serde::__private::Ok(#this_value::#ident))
|
||||
@ -2360,8 +2375,9 @@ fn deserialize_identifier(
|
||||
}
|
||||
}
|
||||
} else {
|
||||
let u64_mapping = fields.iter().enumerate().map(|(i, (_, ident, _))| {
|
||||
let u64_mapping = deserialized_fields.iter().enumerate().map(|(i, field)| {
|
||||
let i = i as u64;
|
||||
let ident = &field.ident;
|
||||
quote!(#i => _serde::__private::Ok(#this_value::#ident))
|
||||
});
|
||||
|
||||
@ -2370,7 +2386,11 @@ fn deserialize_identifier(
|
||||
fallthrough
|
||||
} else {
|
||||
let index_expecting = if is_variant { "variant" } else { "field" };
|
||||
let fallthrough_msg = format!("{} index 0 <= i < {}", index_expecting, fields.len());
|
||||
let fallthrough_msg = format!(
|
||||
"{} index 0 <= i < {}",
|
||||
index_expecting,
|
||||
deserialized_fields.len(),
|
||||
);
|
||||
u64_fallthrough_arm_tokens = quote! {
|
||||
_serde::__private::Err(_serde::de::Error::invalid_value(
|
||||
_serde::de::Unexpected::Unsigned(__value),
|
||||
@ -2647,7 +2667,11 @@ fn deserialize_map(
|
||||
attr::Default::Default => Some(quote!(
|
||||
let __default: Self::Value = _serde::__private::Default::default();
|
||||
)),
|
||||
attr::Default::Path(path) => Some(quote!(
|
||||
// If #path returns wrong type, error will be reported here (^^^^^).
|
||||
// We attach span of the path to the function so it will be reported
|
||||
// on the #[serde(default = "...")]
|
||||
// ^^^^^
|
||||
attr::Default::Path(path) => Some(quote_spanned!(path.span()=>
|
||||
let __default: Self::Value = #path();
|
||||
)),
|
||||
attr::Default::None => {
|
||||
@ -2817,7 +2841,11 @@ fn deserialize_map_in_place(
|
||||
attr::Default::Default => Some(quote!(
|
||||
let __default: #this_type #ty_generics = _serde::__private::Default::default();
|
||||
)),
|
||||
attr::Default::Path(path) => Some(quote!(
|
||||
// If #path returns wrong type, error will be reported here (^^^^^).
|
||||
// We attach span of the path to the function so it will be reported
|
||||
// on the #[serde(default = "...")]
|
||||
// ^^^^^
|
||||
attr::Default::Path(path) => Some(quote_spanned!(path.span()=>
|
||||
let __default: #this_type #ty_generics = #path();
|
||||
)),
|
||||
attr::Default::None => {
|
||||
@ -2855,7 +2883,15 @@ fn wrap_deserialize_with(
|
||||
let (de_impl_generics, de_ty_generics, ty_generics, where_clause) =
|
||||
split_with_de_lifetime(params);
|
||||
let delife = params.borrowed.de_lifetime();
|
||||
let deserializer_var = quote!(__deserializer);
|
||||
|
||||
// If #deserialize_with returns wrong type, error will be reported here (^^^^^).
|
||||
// We attach span of the path to the function so it will be reported
|
||||
// on the #[serde(with = "...")]
|
||||
// ^^^^^
|
||||
let value = quote_spanned! {deserialize_with.span()=>
|
||||
#deserialize_with(#deserializer_var)?
|
||||
};
|
||||
let wrapper = quote! {
|
||||
#[doc(hidden)]
|
||||
struct __DeserializeWith #de_impl_generics #where_clause {
|
||||
@ -2865,12 +2901,12 @@ fn wrap_deserialize_with(
|
||||
}
|
||||
|
||||
impl #de_impl_generics _serde::Deserialize<#delife> for __DeserializeWith #de_ty_generics #where_clause {
|
||||
fn deserialize<__D>(__deserializer: __D) -> _serde::__private::Result<Self, __D::Error>
|
||||
fn deserialize<__D>(#deserializer_var: __D) -> _serde::__private::Result<Self, __D::Error>
|
||||
where
|
||||
__D: _serde::Deserializer<#delife>,
|
||||
{
|
||||
_serde::__private::Ok(__DeserializeWith {
|
||||
value: #deserialize_with(__deserializer)?,
|
||||
value: #value,
|
||||
phantom: _serde::__private::PhantomData,
|
||||
lifetime: _serde::__private::PhantomData,
|
||||
})
|
||||
@ -2961,7 +2997,11 @@ fn expr_is_missing(field: &Field, cattrs: &attr::Container) -> Fragment {
|
||||
return quote_expr!(#func());
|
||||
}
|
||||
attr::Default::Path(path) => {
|
||||
return quote_expr!(#path());
|
||||
// If #path returns wrong type, error will be reported here (^^^^^).
|
||||
// We attach span of the path to the function so it will be reported
|
||||
// on the #[serde(default = "...")]
|
||||
// ^^^^^
|
||||
return Fragment::Expr(quote_spanned!(path.span()=> #path()));
|
||||
}
|
||||
attr::Default::None => { /* below */ }
|
||||
}
|
||||
@ -3004,6 +3044,10 @@ fn expr_is_missing_seq(
|
||||
return quote_spanned!(span=> #assign_to _serde::__private::Default::default());
|
||||
}
|
||||
attr::Default::Path(path) => {
|
||||
// If #path returns wrong type, error will be reported here (^^^^^).
|
||||
// We attach span of the path to the function so it will be reported
|
||||
// on the #[serde(default = "...")]
|
||||
// ^^^^^
|
||||
return quote_spanned!(path.span()=> #assign_to #path());
|
||||
}
|
||||
attr::Default::None => { /* below */ }
|
@ -8,6 +8,7 @@ use std::iter::FromIterator;
|
||||
use syn::meta::ParseNestedMeta;
|
||||
use syn::parse::ParseStream;
|
||||
use syn::punctuated::Punctuated;
|
||||
use syn::spanned::Spanned;
|
||||
use syn::{parse_quote, token, Ident, Lifetime, Token};
|
||||
|
||||
// This module handles parsing of `#[serde(...)]` attributes. The entrypoints
|
||||
@ -888,13 +889,13 @@ impl Variant {
|
||||
ser_path
|
||||
.path
|
||||
.segments
|
||||
.push(Ident::new("serialize", Span::call_site()).into());
|
||||
.push(Ident::new("serialize", ser_path.span()).into());
|
||||
serialize_with.set(&meta.path, ser_path);
|
||||
let mut de_path = path;
|
||||
de_path
|
||||
.path
|
||||
.segments
|
||||
.push(Ident::new("deserialize", Span::call_site()).into());
|
||||
.push(Ident::new("deserialize", de_path.span()).into());
|
||||
deserialize_with.set(&meta.path, de_path);
|
||||
}
|
||||
} else if meta.path == SERIALIZE_WITH {
|
||||
@ -1170,13 +1171,13 @@ impl Field {
|
||||
ser_path
|
||||
.path
|
||||
.segments
|
||||
.push(Ident::new("serialize", Span::call_site()).into());
|
||||
.push(Ident::new("serialize", ser_path.span()).into());
|
||||
serialize_with.set(&meta.path, ser_path);
|
||||
let mut de_path = path;
|
||||
de_path
|
||||
.path
|
||||
.segments
|
||||
.push(Ident::new("deserialize", Span::call_site()).into());
|
||||
.push(Ident::new("deserialize", de_path.span()).into());
|
||||
deserialize_with.set(&meta.path, de_path);
|
||||
}
|
||||
} else if meta.path == BOUND {
|
@ -209,7 +209,9 @@ impl ReplaceReceiver<'_> {
|
||||
match bound {
|
||||
#![cfg_attr(all(test, exhaustive), deny(non_exhaustive_omitted_patterns))]
|
||||
TypeParamBound::Trait(bound) => self.visit_path_mut(&mut bound.path),
|
||||
TypeParamBound::Lifetime(_) | TypeParamBound::Verbatim(_) => {}
|
||||
TypeParamBound::Lifetime(_)
|
||||
| TypeParamBound::PreciseCapture(_)
|
||||
| TypeParamBound::Verbatim(_) => {}
|
||||
_ => {}
|
||||
}
|
||||
}
|
@ -46,7 +46,7 @@ impl PartialEq<Symbol> for Ident {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> PartialEq<Symbol> for &'a Ident {
|
||||
impl PartialEq<Symbol> for &Ident {
|
||||
fn eq(&self, word: &Symbol) -> bool {
|
||||
*self == word.0
|
||||
}
|
||||
@ -58,7 +58,7 @@ impl PartialEq<Symbol> for Path {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> PartialEq<Symbol> for &'a Path {
|
||||
impl PartialEq<Symbol> for &Path {
|
||||
fn eq(&self, word: &Symbol) -> bool {
|
||||
self.is_ident(word.0)
|
||||
}
|
@ -13,7 +13,7 @@
|
||||
//!
|
||||
//! [https://serde.rs/derive.html]: https://serde.rs/derive.html
|
||||
|
||||
#![doc(html_root_url = "https://docs.rs/serde_derive/1.0.210")]
|
||||
#![doc(html_root_url = "https://docs.rs/serde_derive/1.0.213")]
|
||||
#![cfg_attr(not(check_cfg), allow(unexpected_cfgs))]
|
||||
// Ignored clippy lints
|
||||
#![allow(
|
||||
@ -27,6 +27,7 @@
|
||||
// clippy bug: https://github.com/rust-lang/rust-clippy/issues/6797
|
||||
clippy::manual_map,
|
||||
clippy::match_like_matches_macro,
|
||||
clippy::needless_lifetimes,
|
||||
clippy::needless_pass_by_value,
|
||||
clippy::too_many_arguments,
|
||||
clippy::trivially_copy_pass_by_ref,
|
||||
@ -55,6 +56,7 @@
|
||||
clippy::single_match_else,
|
||||
clippy::struct_excessive_bools,
|
||||
clippy::too_many_lines,
|
||||
clippy::uninlined_format_args,
|
||||
clippy::unseparated_literal_suffix,
|
||||
clippy::unused_self,
|
||||
clippy::use_self,
|
@ -1220,6 +1220,17 @@ fn wrap_serialize_with(
|
||||
})
|
||||
});
|
||||
|
||||
let self_var = quote!(self);
|
||||
let serializer_var = quote!(__s);
|
||||
|
||||
// If #serialize_with returns wrong type, error will be reported on here.
|
||||
// We attach span of the path to this piece so error will be reported
|
||||
// on the #[serde(with = "...")]
|
||||
// ^^^^^
|
||||
let wrapper_serialize = quote_spanned! {serialize_with.span()=>
|
||||
#serialize_with(#(#self_var.values.#field_access, )* #serializer_var)
|
||||
};
|
||||
|
||||
quote!({
|
||||
#[doc(hidden)]
|
||||
struct __SerializeWith #wrapper_impl_generics #where_clause {
|
||||
@ -1228,11 +1239,11 @@ fn wrap_serialize_with(
|
||||
}
|
||||
|
||||
impl #wrapper_impl_generics _serde::Serialize for __SerializeWith #wrapper_ty_generics #where_clause {
|
||||
fn serialize<__S>(&self, __s: __S) -> _serde::__private::Result<__S::Ok, __S::Error>
|
||||
fn serialize<__S>(&#self_var, #serializer_var: __S) -> _serde::__private::Result<__S::Ok, __S::Error>
|
||||
where
|
||||
__S: _serde::Serializer,
|
||||
{
|
||||
#serialize_with(#(self.values.#field_access, )* __s)
|
||||
#wrapper_serialize
|
||||
}
|
||||
}
|
||||
|
46
third_party/rust/serde/v1/BUILD.gn
vendored
46
third_party/rust/serde/v1/BUILD.gn
vendored
@ -13,33 +13,33 @@ cargo_crate("lib") {
|
||||
epoch = "1"
|
||||
crate_type = "rlib"
|
||||
crate_root =
|
||||
"//third_party/rust/chromium_crates_io/vendor/serde-1.0.210/src/lib.rs"
|
||||
"//third_party/rust/chromium_crates_io/vendor/serde-1.0.213/src/lib.rs"
|
||||
sources = [
|
||||
"//third_party/rust/chromium_crates_io/vendor/serde-1.0.210/src/de/ignored_any.rs",
|
||||
"//third_party/rust/chromium_crates_io/vendor/serde-1.0.210/src/de/impls.rs",
|
||||
"//third_party/rust/chromium_crates_io/vendor/serde-1.0.210/src/de/mod.rs",
|
||||
"//third_party/rust/chromium_crates_io/vendor/serde-1.0.210/src/de/seed.rs",
|
||||
"//third_party/rust/chromium_crates_io/vendor/serde-1.0.210/src/de/size_hint.rs",
|
||||
"//third_party/rust/chromium_crates_io/vendor/serde-1.0.210/src/de/value.rs",
|
||||
"//third_party/rust/chromium_crates_io/vendor/serde-1.0.210/src/format.rs",
|
||||
"//third_party/rust/chromium_crates_io/vendor/serde-1.0.210/src/integer128.rs",
|
||||
"//third_party/rust/chromium_crates_io/vendor/serde-1.0.210/src/lib.rs",
|
||||
"//third_party/rust/chromium_crates_io/vendor/serde-1.0.210/src/macros.rs",
|
||||
"//third_party/rust/chromium_crates_io/vendor/serde-1.0.210/src/private/de.rs",
|
||||
"//third_party/rust/chromium_crates_io/vendor/serde-1.0.210/src/private/doc.rs",
|
||||
"//third_party/rust/chromium_crates_io/vendor/serde-1.0.210/src/private/mod.rs",
|
||||
"//third_party/rust/chromium_crates_io/vendor/serde-1.0.210/src/private/ser.rs",
|
||||
"//third_party/rust/chromium_crates_io/vendor/serde-1.0.210/src/ser/fmt.rs",
|
||||
"//third_party/rust/chromium_crates_io/vendor/serde-1.0.210/src/ser/impls.rs",
|
||||
"//third_party/rust/chromium_crates_io/vendor/serde-1.0.210/src/ser/impossible.rs",
|
||||
"//third_party/rust/chromium_crates_io/vendor/serde-1.0.210/src/ser/mod.rs",
|
||||
"//third_party/rust/chromium_crates_io/vendor/serde-1.0.210/src/std_error.rs",
|
||||
"//third_party/rust/chromium_crates_io/vendor/serde-1.0.213/src/de/ignored_any.rs",
|
||||
"//third_party/rust/chromium_crates_io/vendor/serde-1.0.213/src/de/impls.rs",
|
||||
"//third_party/rust/chromium_crates_io/vendor/serde-1.0.213/src/de/mod.rs",
|
||||
"//third_party/rust/chromium_crates_io/vendor/serde-1.0.213/src/de/seed.rs",
|
||||
"//third_party/rust/chromium_crates_io/vendor/serde-1.0.213/src/de/size_hint.rs",
|
||||
"//third_party/rust/chromium_crates_io/vendor/serde-1.0.213/src/de/value.rs",
|
||||
"//third_party/rust/chromium_crates_io/vendor/serde-1.0.213/src/format.rs",
|
||||
"//third_party/rust/chromium_crates_io/vendor/serde-1.0.213/src/integer128.rs",
|
||||
"//third_party/rust/chromium_crates_io/vendor/serde-1.0.213/src/lib.rs",
|
||||
"//third_party/rust/chromium_crates_io/vendor/serde-1.0.213/src/macros.rs",
|
||||
"//third_party/rust/chromium_crates_io/vendor/serde-1.0.213/src/private/de.rs",
|
||||
"//third_party/rust/chromium_crates_io/vendor/serde-1.0.213/src/private/doc.rs",
|
||||
"//third_party/rust/chromium_crates_io/vendor/serde-1.0.213/src/private/mod.rs",
|
||||
"//third_party/rust/chromium_crates_io/vendor/serde-1.0.213/src/private/ser.rs",
|
||||
"//third_party/rust/chromium_crates_io/vendor/serde-1.0.213/src/ser/fmt.rs",
|
||||
"//third_party/rust/chromium_crates_io/vendor/serde-1.0.213/src/ser/impls.rs",
|
||||
"//third_party/rust/chromium_crates_io/vendor/serde-1.0.213/src/ser/impossible.rs",
|
||||
"//third_party/rust/chromium_crates_io/vendor/serde-1.0.213/src/ser/mod.rs",
|
||||
"//third_party/rust/chromium_crates_io/vendor/serde-1.0.213/src/std_error.rs",
|
||||
]
|
||||
inputs = []
|
||||
|
||||
build_native_rust_unit_tests = false
|
||||
edition = "2018"
|
||||
cargo_pkg_version = "1.0.210"
|
||||
cargo_pkg_version = "1.0.213"
|
||||
cargo_pkg_authors = "Erick Tryzelaar <erick.tryzelaar@gmail.com>, David Tolnay <dtolnay@gmail.com>"
|
||||
cargo_pkg_name = "serde"
|
||||
cargo_pkg_description = "A generic serialization/deserialization framework"
|
||||
@ -56,7 +56,7 @@ cargo_crate("lib") {
|
||||
"std",
|
||||
]
|
||||
build_root =
|
||||
"//third_party/rust/chromium_crates_io/vendor/serde-1.0.210/build.rs"
|
||||
"//third_party/rust/chromium_crates_io/vendor/serde-1.0.213/build.rs"
|
||||
build_sources =
|
||||
[ "//third_party/rust/chromium_crates_io/vendor/serde-1.0.210/build.rs" ]
|
||||
[ "//third_party/rust/chromium_crates_io/vendor/serde-1.0.213/build.rs" ]
|
||||
}
|
||||
|
6
third_party/rust/serde/v1/README.chromium
vendored
6
third_party/rust/serde/v1/README.chromium
vendored
@ -1,9 +1,9 @@
|
||||
Name: serde
|
||||
URL: https://crates.io/crates/serde
|
||||
Version: 1.0.210
|
||||
Revision: 89c4b02bf32ceae5b17d89f93a452ccc195ca038
|
||||
Version: 1.0.213
|
||||
Revision: 58a8d229315553c4ae0a8d7eee8e382fbae4b4bf
|
||||
License: Apache 2.0
|
||||
License File: //third_party/rust/chromium_crates_io/vendor/serde-1.0.210/LICENSE-APACHE
|
||||
License File: //third_party/rust/chromium_crates_io/vendor/serde-1.0.213/LICENSE-APACHE
|
||||
Shipped: yes
|
||||
Security Critical: yes
|
||||
|
||||
|
38
third_party/rust/serde_derive/v1/BUILD.gn
vendored
38
third_party/rust/serde_derive/v1/BUILD.gn
vendored
@ -12,31 +12,31 @@ cargo_crate("lib") {
|
||||
crate_name = "serde_derive"
|
||||
epoch = "1"
|
||||
crate_type = "proc-macro"
|
||||
crate_root = "//third_party/rust/chromium_crates_io/vendor/serde_derive-1.0.210/src/lib.rs"
|
||||
crate_root = "//third_party/rust/chromium_crates_io/vendor/serde_derive-1.0.213/src/lib.rs"
|
||||
sources = [
|
||||
"//third_party/rust/chromium_crates_io/vendor/serde_derive-1.0.210/src/bound.rs",
|
||||
"//third_party/rust/chromium_crates_io/vendor/serde_derive-1.0.210/src/de.rs",
|
||||
"//third_party/rust/chromium_crates_io/vendor/serde_derive-1.0.210/src/dummy.rs",
|
||||
"//third_party/rust/chromium_crates_io/vendor/serde_derive-1.0.210/src/fragment.rs",
|
||||
"//third_party/rust/chromium_crates_io/vendor/serde_derive-1.0.210/src/internals/ast.rs",
|
||||
"//third_party/rust/chromium_crates_io/vendor/serde_derive-1.0.210/src/internals/attr.rs",
|
||||
"//third_party/rust/chromium_crates_io/vendor/serde_derive-1.0.210/src/internals/case.rs",
|
||||
"//third_party/rust/chromium_crates_io/vendor/serde_derive-1.0.210/src/internals/check.rs",
|
||||
"//third_party/rust/chromium_crates_io/vendor/serde_derive-1.0.210/src/internals/ctxt.rs",
|
||||
"//third_party/rust/chromium_crates_io/vendor/serde_derive-1.0.210/src/internals/mod.rs",
|
||||
"//third_party/rust/chromium_crates_io/vendor/serde_derive-1.0.210/src/internals/receiver.rs",
|
||||
"//third_party/rust/chromium_crates_io/vendor/serde_derive-1.0.210/src/internals/respan.rs",
|
||||
"//third_party/rust/chromium_crates_io/vendor/serde_derive-1.0.210/src/internals/symbol.rs",
|
||||
"//third_party/rust/chromium_crates_io/vendor/serde_derive-1.0.210/src/lib.rs",
|
||||
"//third_party/rust/chromium_crates_io/vendor/serde_derive-1.0.210/src/pretend.rs",
|
||||
"//third_party/rust/chromium_crates_io/vendor/serde_derive-1.0.210/src/ser.rs",
|
||||
"//third_party/rust/chromium_crates_io/vendor/serde_derive-1.0.210/src/this.rs",
|
||||
"//third_party/rust/chromium_crates_io/vendor/serde_derive-1.0.213/src/bound.rs",
|
||||
"//third_party/rust/chromium_crates_io/vendor/serde_derive-1.0.213/src/de.rs",
|
||||
"//third_party/rust/chromium_crates_io/vendor/serde_derive-1.0.213/src/dummy.rs",
|
||||
"//third_party/rust/chromium_crates_io/vendor/serde_derive-1.0.213/src/fragment.rs",
|
||||
"//third_party/rust/chromium_crates_io/vendor/serde_derive-1.0.213/src/internals/ast.rs",
|
||||
"//third_party/rust/chromium_crates_io/vendor/serde_derive-1.0.213/src/internals/attr.rs",
|
||||
"//third_party/rust/chromium_crates_io/vendor/serde_derive-1.0.213/src/internals/case.rs",
|
||||
"//third_party/rust/chromium_crates_io/vendor/serde_derive-1.0.213/src/internals/check.rs",
|
||||
"//third_party/rust/chromium_crates_io/vendor/serde_derive-1.0.213/src/internals/ctxt.rs",
|
||||
"//third_party/rust/chromium_crates_io/vendor/serde_derive-1.0.213/src/internals/mod.rs",
|
||||
"//third_party/rust/chromium_crates_io/vendor/serde_derive-1.0.213/src/internals/receiver.rs",
|
||||
"//third_party/rust/chromium_crates_io/vendor/serde_derive-1.0.213/src/internals/respan.rs",
|
||||
"//third_party/rust/chromium_crates_io/vendor/serde_derive-1.0.213/src/internals/symbol.rs",
|
||||
"//third_party/rust/chromium_crates_io/vendor/serde_derive-1.0.213/src/lib.rs",
|
||||
"//third_party/rust/chromium_crates_io/vendor/serde_derive-1.0.213/src/pretend.rs",
|
||||
"//third_party/rust/chromium_crates_io/vendor/serde_derive-1.0.213/src/ser.rs",
|
||||
"//third_party/rust/chromium_crates_io/vendor/serde_derive-1.0.213/src/this.rs",
|
||||
]
|
||||
inputs = []
|
||||
|
||||
build_native_rust_unit_tests = false
|
||||
edition = "2015"
|
||||
cargo_pkg_version = "1.0.210"
|
||||
cargo_pkg_version = "1.0.213"
|
||||
cargo_pkg_authors = "Erick Tryzelaar <erick.tryzelaar@gmail.com>, David Tolnay <dtolnay@gmail.com>"
|
||||
cargo_pkg_name = "serde_derive"
|
||||
cargo_pkg_description =
|
||||
|
@ -1,9 +1,9 @@
|
||||
Name: serde_derive
|
||||
URL: https://crates.io/crates/serde_derive
|
||||
Version: 1.0.210
|
||||
Revision: 89c4b02bf32ceae5b17d89f93a452ccc195ca038
|
||||
Version: 1.0.213
|
||||
Revision: 58a8d229315553c4ae0a8d7eee8e382fbae4b4bf
|
||||
License: Apache 2.0
|
||||
License File: //third_party/rust/chromium_crates_io/vendor/serde_derive-1.0.210/LICENSE-APACHE
|
||||
License File: //third_party/rust/chromium_crates_io/vendor/serde_derive-1.0.213/LICENSE-APACHE
|
||||
Shipped: yes
|
||||
Security Critical: yes
|
||||
|
||||
|
Reference in New Issue
Block a user