mirror of
https://github.com/pezkuwichain/serde.git
synced 2026-04-26 06:17:55 +00:00
Compare commits
16 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 7c04c98e0e | |||
| a2fa4c2570 | |||
| 42430902e2 | |||
| 23e2e92237 | |||
| 273b2c11c6 | |||
| c1602a4d76 | |||
| c23be3f855 | |||
| 5c9c97c0ce | |||
| e5ed440136 | |||
| d45ca2f5e4 | |||
| d7f9f8209d | |||
| 4a2612ecff | |||
| 05b22a06d7 | |||
| 3145bcc46e | |||
| f9946ee0ca | |||
| a164f52315 |
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "serde"
|
name = "serde"
|
||||||
version = "1.0.34" # remember to update html_root_url
|
version = "1.0.36" # remember to update html_root_url
|
||||||
authors = ["Erick Tryzelaar <erick.tryzelaar@gmail.com>", "David Tolnay <dtolnay@gmail.com>"]
|
authors = ["Erick Tryzelaar <erick.tryzelaar@gmail.com>", "David Tolnay <dtolnay@gmail.com>"]
|
||||||
license = "MIT/Apache-2.0"
|
license = "MIT/Apache-2.0"
|
||||||
description = "A generic serialization/deserialization framework"
|
description = "A generic serialization/deserialization framework"
|
||||||
|
|||||||
@@ -1918,6 +1918,7 @@ where
|
|||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#[cfg(feature = "unstable")]
|
#[cfg(feature = "unstable")]
|
||||||
|
#[allow(deprecated)]
|
||||||
impl<'de, T> Deserialize<'de> for NonZero<T>
|
impl<'de, T> Deserialize<'de> for NonZero<T>
|
||||||
where
|
where
|
||||||
T: Deserialize<'de> + Zeroable,
|
T: Deserialize<'de> + Zeroable,
|
||||||
@@ -1934,6 +1935,36 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
macro_rules! nonzero_integers {
|
||||||
|
( $( $T: ty, )+ ) => {
|
||||||
|
$(
|
||||||
|
#[cfg(feature = "unstable")]
|
||||||
|
impl<'de> Deserialize<'de> for $T {
|
||||||
|
fn deserialize<D>(deserializer: D) -> Result<$T, D::Error>
|
||||||
|
where
|
||||||
|
D: Deserializer<'de>,
|
||||||
|
{
|
||||||
|
let value = try!(Deserialize::deserialize(deserializer));
|
||||||
|
match <$T>::new(value) {
|
||||||
|
Some(nonzero) => Ok(nonzero),
|
||||||
|
None => Err(Error::custom("expected a non-zero value")),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)+
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
nonzero_integers! {
|
||||||
|
// Not including signed NonZeroI* since they might be removed
|
||||||
|
NonZeroU8,
|
||||||
|
NonZeroU16,
|
||||||
|
NonZeroU32,
|
||||||
|
NonZeroU64,
|
||||||
|
// FIXME: https://github.com/serde-rs/serde/issues/1136 NonZeroU128,
|
||||||
|
NonZeroUsize,
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
impl<'de, T, E> Deserialize<'de> for Result<T, E>
|
impl<'de, T, E> Deserialize<'de> for Result<T, E>
|
||||||
|
|||||||
+2
-1
@@ -98,7 +98,8 @@
|
|||||||
//! - Path
|
//! - Path
|
||||||
//! - PathBuf
|
//! - PathBuf
|
||||||
//! - Range\<T\>
|
//! - Range\<T\>
|
||||||
//! - NonZero\<T\> (unstable)
|
//! - NonZero\<T\> (unstable, deprecated)
|
||||||
|
//! - num::NonZero* (unstable)
|
||||||
//! - **Net types**:
|
//! - **Net types**:
|
||||||
//! - IpAddr
|
//! - IpAddr
|
||||||
//! - Ipv4Addr
|
//! - Ipv4Addr
|
||||||
|
|||||||
+5
-1
@@ -79,7 +79,7 @@
|
|||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
// Serde types in rustdoc of other crates get linked to here.
|
// Serde types in rustdoc of other crates get linked to here.
|
||||||
#![doc(html_root_url = "https://docs.rs/serde/1.0.34")]
|
#![doc(html_root_url = "https://docs.rs/serde/1.0.36")]
|
||||||
// Support using Serde without the standard library!
|
// Support using Serde without the standard library!
|
||||||
#![cfg_attr(not(feature = "std"), no_std)]
|
#![cfg_attr(not(feature = "std"), no_std)]
|
||||||
// Unstable functionality only if the user asks for it. For tracking and
|
// Unstable functionality only if the user asks for it. For tracking and
|
||||||
@@ -211,7 +211,11 @@ mod lib {
|
|||||||
pub use std::sync::{Mutex, RwLock};
|
pub use std::sync::{Mutex, RwLock};
|
||||||
|
|
||||||
#[cfg(feature = "unstable")]
|
#[cfg(feature = "unstable")]
|
||||||
|
#[allow(deprecated)]
|
||||||
pub use core::nonzero::{NonZero, Zeroable};
|
pub use core::nonzero::{NonZero, Zeroable};
|
||||||
|
|
||||||
|
#[cfg(feature = "unstable")]
|
||||||
|
pub use core::num::{NonZeroU8, NonZeroU16, NonZeroU32, NonZeroU64, NonZeroUsize};
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|||||||
@@ -351,6 +351,7 @@ deref_impl!(<'a, T: ?Sized> Serialize for Cow<'a, T> where T: Serialize + ToOwne
|
|||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#[cfg(feature = "unstable")]
|
#[cfg(feature = "unstable")]
|
||||||
|
#[allow(deprecated)]
|
||||||
impl<T> Serialize for NonZero<T>
|
impl<T> Serialize for NonZero<T>
|
||||||
where
|
where
|
||||||
T: Serialize + Zeroable + Clone,
|
T: Serialize + Zeroable + Clone,
|
||||||
@@ -363,6 +364,32 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
macro_rules! nonzero_integers {
|
||||||
|
( $( $T: ident, )+ ) => {
|
||||||
|
$(
|
||||||
|
#[cfg(feature = "unstable")]
|
||||||
|
impl Serialize for $T {
|
||||||
|
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
||||||
|
where
|
||||||
|
S: Serializer,
|
||||||
|
{
|
||||||
|
self.get().serialize(serializer)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)+
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
nonzero_integers! {
|
||||||
|
// Not including signed NonZeroI* since they might be removed
|
||||||
|
NonZeroU8,
|
||||||
|
NonZeroU16,
|
||||||
|
NonZeroU32,
|
||||||
|
NonZeroU64,
|
||||||
|
// FIXME: https://github.com/serde-rs/serde/issues/1136 NonZeroU128,
|
||||||
|
NonZeroUsize,
|
||||||
|
}
|
||||||
|
|
||||||
impl<T> Serialize for Cell<T>
|
impl<T> Serialize for Cell<T>
|
||||||
where
|
where
|
||||||
T: Serialize + Copy,
|
T: Serialize + Copy,
|
||||||
|
|||||||
@@ -93,7 +93,8 @@
|
|||||||
//! - Path
|
//! - Path
|
||||||
//! - PathBuf
|
//! - PathBuf
|
||||||
//! - Range\<T\>
|
//! - Range\<T\>
|
||||||
//! - NonZero\<T\> (unstable)
|
//! - NonZero\<T\> (unstable, deprecated)
|
||||||
|
//! - num::NonZero* (unstable)
|
||||||
//! - **Net types**:
|
//! - **Net types**:
|
||||||
//! - IpAddr
|
//! - IpAddr
|
||||||
//! - Ipv4Addr
|
//! - Ipv4Addr
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "serde_derive"
|
name = "serde_derive"
|
||||||
version = "1.0.34" # remember to update html_root_url
|
version = "1.0.36" # remember to update html_root_url
|
||||||
authors = ["Erick Tryzelaar <erick.tryzelaar@gmail.com>", "David Tolnay <dtolnay@gmail.com>"]
|
authors = ["Erick Tryzelaar <erick.tryzelaar@gmail.com>", "David Tolnay <dtolnay@gmail.com>"]
|
||||||
license = "MIT/Apache-2.0"
|
license = "MIT/Apache-2.0"
|
||||||
description = "Macros 1.1 implementation of #[derive(Serialize, Deserialize)]"
|
description = "Macros 1.1 implementation of #[derive(Serialize, Deserialize)]"
|
||||||
@@ -25,7 +25,7 @@ proc-macro = true
|
|||||||
[dependencies]
|
[dependencies]
|
||||||
proc-macro2 = "0.2"
|
proc-macro2 = "0.2"
|
||||||
quote = "0.4"
|
quote = "0.4"
|
||||||
serde_derive_internals = { version = "=0.22.0", default-features = false, path = "../serde_derive_internals" }
|
serde_derive_internals = { version = "=0.22.2", default-features = false, path = "../serde_derive_internals" }
|
||||||
syn = { version = "0.12", features = ["visit"] }
|
syn = { version = "0.12", features = ["visit"] }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
|
|||||||
+10
-60
@@ -349,7 +349,7 @@ fn deserialize_tuple(
|
|||||||
split_with_de_lifetime(params);
|
split_with_de_lifetime(params);
|
||||||
let delife = params.borrowed.de_lifetime();
|
let delife = params.borrowed.de_lifetime();
|
||||||
|
|
||||||
debug_assert!(!cattrs.has_flatten());
|
assert!(!cattrs.has_flatten());
|
||||||
|
|
||||||
// If there are getters (implying private fields), construct the local type
|
// If there are getters (implying private fields), construct the local type
|
||||||
// and use an `Into` conversion to get the remote type. If there are no
|
// and use an `Into` conversion to get the remote type. If there are no
|
||||||
@@ -446,7 +446,7 @@ fn deserialize_tuple_in_place(
|
|||||||
split_with_de_lifetime(params);
|
split_with_de_lifetime(params);
|
||||||
let delife = params.borrowed.de_lifetime();
|
let delife = params.borrowed.de_lifetime();
|
||||||
|
|
||||||
debug_assert!(!cattrs.has_flatten());
|
assert!(!cattrs.has_flatten());
|
||||||
|
|
||||||
let is_enum = variant_ident.is_some();
|
let is_enum = variant_ident.is_some();
|
||||||
let expecting = match variant_ident {
|
let expecting = match variant_ident {
|
||||||
@@ -923,7 +923,7 @@ fn deserialize_struct_in_place(
|
|||||||
params, fields, cattrs);
|
params, fields, cattrs);
|
||||||
|
|
||||||
let field_visitor = Stmts(field_visitor);
|
let field_visitor = Stmts(field_visitor);
|
||||||
let fields_stmt = fields_stmt.map(Stmts);
|
let fields_stmt = Stmts(fields_stmt);
|
||||||
let visit_map = Stmts(visit_map);
|
let visit_map = Stmts(visit_map);
|
||||||
|
|
||||||
let visitor_expr = quote! {
|
let visitor_expr = quote! {
|
||||||
@@ -2104,7 +2104,7 @@ fn deserialize_struct_as_struct_visitor(
|
|||||||
fields: &[Field],
|
fields: &[Field],
|
||||||
cattrs: &attr::Container,
|
cattrs: &attr::Container,
|
||||||
) -> (Fragment, Option<Fragment>, Fragment) {
|
) -> (Fragment, Option<Fragment>, Fragment) {
|
||||||
debug_assert!(!cattrs.has_flatten());
|
assert!(!cattrs.has_flatten());
|
||||||
|
|
||||||
let field_names_idents: Vec<_> = fields
|
let field_names_idents: Vec<_> = fields
|
||||||
.iter()
|
.iter()
|
||||||
@@ -2353,8 +2353,8 @@ fn deserialize_struct_as_struct_in_place_visitor(
|
|||||||
params: &Parameters,
|
params: &Parameters,
|
||||||
fields: &[Field],
|
fields: &[Field],
|
||||||
cattrs: &attr::Container,
|
cattrs: &attr::Container,
|
||||||
) -> (Fragment, Option<Fragment>, Fragment) {
|
) -> (Fragment, Fragment, Fragment) {
|
||||||
debug_assert!(!cattrs.has_flatten());
|
assert!(!cattrs.has_flatten());
|
||||||
|
|
||||||
let field_names_idents: Vec<_> = fields
|
let field_names_idents: Vec<_> = fields
|
||||||
.iter()
|
.iter()
|
||||||
@@ -2374,7 +2374,7 @@ fn deserialize_struct_as_struct_in_place_visitor(
|
|||||||
|
|
||||||
let visit_map = deserialize_map_in_place(params, fields, cattrs);
|
let visit_map = deserialize_map_in_place(params, fields, cattrs);
|
||||||
|
|
||||||
(field_visitor, Some(fields_stmt), visit_map)
|
(field_visitor, fields_stmt, visit_map)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "deserialize_in_place")]
|
#[cfg(feature = "deserialize_in_place")]
|
||||||
@@ -2383,7 +2383,7 @@ fn deserialize_map_in_place(
|
|||||||
fields: &[Field],
|
fields: &[Field],
|
||||||
cattrs: &attr::Container,
|
cattrs: &attr::Container,
|
||||||
) -> Fragment {
|
) -> Fragment {
|
||||||
debug_assert!(!cattrs.has_flatten());
|
assert!(!cattrs.has_flatten());
|
||||||
|
|
||||||
// Create the field names for the fields.
|
// Create the field names for the fields.
|
||||||
let fields_names: Vec<_> = fields
|
let fields_names: Vec<_> = fields
|
||||||
@@ -2402,18 +2402,6 @@ fn deserialize_map_in_place(
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Collect contents for flatten fields into a buffer
|
|
||||||
let let_collect = if cattrs.has_flatten() {
|
|
||||||
Some(quote! {
|
|
||||||
let mut __collect = Vec::<Option<(
|
|
||||||
_serde::private::de::Content,
|
|
||||||
_serde::private::de::Content
|
|
||||||
)>>::new();
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
None
|
|
||||||
};
|
|
||||||
|
|
||||||
// Match arms to extract a value for a field.
|
// Match arms to extract a value for a field.
|
||||||
let value_arms_from = fields_names
|
let value_arms_from = fields_names
|
||||||
.iter()
|
.iter()
|
||||||
@@ -2448,13 +2436,7 @@ fn deserialize_map_in_place(
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Visit ignored values to consume them
|
// Visit ignored values to consume them
|
||||||
let ignored_arm = if cattrs.has_flatten() {
|
let ignored_arm = if cattrs.deny_unknown_fields() {
|
||||||
Some(quote! {
|
|
||||||
__Field::__other(__name) => {
|
|
||||||
__collect.push(Some((__name, try!(_serde::de::MapAccess::next_value(&mut __map)))));
|
|
||||||
}
|
|
||||||
})
|
|
||||||
} else if cattrs.deny_unknown_fields() {
|
|
||||||
None
|
None
|
||||||
} else {
|
} else {
|
||||||
Some(quote! {
|
Some(quote! {
|
||||||
@@ -2462,7 +2444,7 @@ fn deserialize_map_in_place(
|
|||||||
})
|
})
|
||||||
};
|
};
|
||||||
|
|
||||||
let all_skipped = !cattrs.has_flatten() && fields.iter().all(|field| field.attrs.skip_deserializing());
|
let all_skipped = fields.iter().all(|field| field.attrs.skip_deserializing());
|
||||||
|
|
||||||
let match_keys = if cattrs.deny_unknown_fields() && all_skipped {
|
let match_keys = if cattrs.deny_unknown_fields() && all_skipped {
|
||||||
quote! {
|
quote! {
|
||||||
@@ -2526,47 +2508,15 @@ fn deserialize_map_in_place(
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
let extract_collected = fields_names
|
|
||||||
.iter()
|
|
||||||
.filter(|&&(field, _)| field.attrs.flatten())
|
|
||||||
.map(|&(field, ref name)| {
|
|
||||||
let field_ty = field.ty;
|
|
||||||
quote! {
|
|
||||||
let #name: #field_ty = try!(_serde::de::Deserialize::deserialize(
|
|
||||||
_serde::private::de::FlatMapDeserializer(
|
|
||||||
&mut __collect,
|
|
||||||
_serde::export::PhantomData)));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
let collected_deny_unknown_fields = if cattrs.has_flatten() && cattrs.deny_unknown_fields() {
|
|
||||||
Some(quote! {
|
|
||||||
if let _serde::export::Some(_serde::export::Some((__key, _))) =
|
|
||||||
__collect.into_iter().filter(|x| x.is_some()).next()
|
|
||||||
{
|
|
||||||
return _serde::export::Err(
|
|
||||||
_serde::de::Error::custom(format_args!("unknown field `{}`", &__key)));
|
|
||||||
}
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
None
|
|
||||||
};
|
|
||||||
|
|
||||||
quote_block! {
|
quote_block! {
|
||||||
#(#let_flags)*
|
#(#let_flags)*
|
||||||
|
|
||||||
#let_collect
|
|
||||||
|
|
||||||
#match_keys
|
#match_keys
|
||||||
|
|
||||||
#let_default
|
#let_default
|
||||||
|
|
||||||
#(#check_flags)*
|
#(#check_flags)*
|
||||||
|
|
||||||
#(#extract_collected)*
|
|
||||||
|
|
||||||
#collected_deny_unknown_fields
|
|
||||||
|
|
||||||
_serde::export::Ok(())
|
_serde::export::Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
//!
|
//!
|
||||||
//! [https://serde.rs/derive.html]: https://serde.rs/derive.html
|
//! [https://serde.rs/derive.html]: https://serde.rs/derive.html
|
||||||
|
|
||||||
#![doc(html_root_url = "https://docs.rs/serde_derive/1.0.34")]
|
#![doc(html_root_url = "https://docs.rs/serde_derive/1.0.36")]
|
||||||
#![cfg_attr(feature = "cargo-clippy", allow(enum_variant_names, redundant_field_names,
|
#![cfg_attr(feature = "cargo-clippy", allow(enum_variant_names, redundant_field_names,
|
||||||
too_many_arguments, used_underscore_binding))]
|
too_many_arguments, used_underscore_binding))]
|
||||||
// The `quote!` macro requires deep recursion.
|
// The `quote!` macro requires deep recursion.
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "serde_derive_internals"
|
name = "serde_derive_internals"
|
||||||
version = "0.22.0" # remember to update html_root_url
|
version = "0.22.2" # remember to update html_root_url
|
||||||
authors = ["Erick Tryzelaar <erick.tryzelaar@gmail.com>", "David Tolnay <dtolnay@gmail.com>"]
|
authors = ["Erick Tryzelaar <erick.tryzelaar@gmail.com>", "David Tolnay <dtolnay@gmail.com>"]
|
||||||
license = "MIT/Apache-2.0"
|
license = "MIT/Apache-2.0"
|
||||||
description = "AST representation used by Serde derive macros. Unstable."
|
description = "AST representation used by Serde derive macros. Unstable."
|
||||||
|
|||||||
@@ -332,7 +332,11 @@ impl Container {
|
|||||||
// Parse `#[serde(remote = "...")]`
|
// Parse `#[serde(remote = "...")]`
|
||||||
Meta(NameValue(ref m)) if m.ident == "remote" => {
|
Meta(NameValue(ref m)) if m.ident == "remote" => {
|
||||||
if let Ok(path) = parse_lit_into_path(cx, m.ident.as_ref(), &m.lit) {
|
if let Ok(path) = parse_lit_into_path(cx, m.ident.as_ref(), &m.lit) {
|
||||||
remote.set(path);
|
if is_primitive_path(&path, "Self") {
|
||||||
|
remote.set(item.ident.into());
|
||||||
|
} else {
|
||||||
|
remote.set(path);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1291,29 +1295,32 @@ fn is_rptr(ty: &syn::Type, elem: fn(&syn::Type) -> bool) -> bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn is_str(ty: &syn::Type) -> bool {
|
fn is_str(ty: &syn::Type) -> bool {
|
||||||
is_primitive_path(ty, "str")
|
is_primitive_type(ty, "str")
|
||||||
}
|
}
|
||||||
|
|
||||||
fn is_slice_u8(ty: &syn::Type) -> bool {
|
fn is_slice_u8(ty: &syn::Type) -> bool {
|
||||||
match *ty {
|
match *ty {
|
||||||
syn::Type::Slice(ref ty) => is_primitive_path(&ty.elem, "u8"),
|
syn::Type::Slice(ref ty) => is_primitive_type(&ty.elem, "u8"),
|
||||||
_ => false,
|
_ => false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn is_primitive_path(ty: &syn::Type, primitive: &str) -> bool {
|
fn is_primitive_type(ty: &syn::Type, primitive: &str) -> bool {
|
||||||
match *ty {
|
match *ty {
|
||||||
syn::Type::Path(ref ty) => {
|
syn::Type::Path(ref ty) => {
|
||||||
ty.qself.is_none()
|
ty.qself.is_none() && is_primitive_path(&ty.path, primitive)
|
||||||
&& ty.path.leading_colon.is_none()
|
|
||||||
&& ty.path.segments.len() == 1
|
|
||||||
&& ty.path.segments[0].ident == primitive
|
|
||||||
&& ty.path.segments[0].arguments.is_empty()
|
|
||||||
}
|
}
|
||||||
_ => false,
|
_ => false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn is_primitive_path(path: &syn::Path, primitive: &str) -> bool {
|
||||||
|
path.leading_colon.is_none()
|
||||||
|
&& path.segments.len() == 1
|
||||||
|
&& path.segments[0].ident == primitive
|
||||||
|
&& path.segments[0].arguments.is_empty()
|
||||||
|
}
|
||||||
|
|
||||||
// All lifetimes that this type could borrow from a Deserializer.
|
// All lifetimes that this type could borrow from a Deserializer.
|
||||||
//
|
//
|
||||||
// For example a type `S<'a, 'b>` could borrow `'a` and `'b`. On the other hand
|
// For example a type `S<'a, 'b>` could borrow `'a` and `'b`. On the other hand
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
// See https://users.rust-lang.org/t/psa-dealing-with-warning-unused-import-std-ascii-asciiext-in-today-s-nightly/13726
|
// See https://users.rust-lang.org/t/psa-dealing-with-warning-unused-import-std-ascii-asciiext-in-today-s-nightly/13726
|
||||||
#[allow(unused_imports)]
|
#[allow(deprecated, unused_imports)]
|
||||||
use std::ascii::AsciiExt;
|
use std::ascii::AsciiExt;
|
||||||
|
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ fn check_getter(cx: &Ctxt, cont: &Container) {
|
|||||||
fn check_flatten(cx: &Ctxt, cont: &Container) {
|
fn check_flatten(cx: &Ctxt, cont: &Container) {
|
||||||
match cont.data {
|
match cont.data {
|
||||||
Data::Enum(_) => {
|
Data::Enum(_) => {
|
||||||
debug_assert!(!cont.attrs.has_flatten());
|
assert!(!cont.attrs.has_flatten());
|
||||||
}
|
}
|
||||||
Data::Struct(_, _) => {
|
Data::Struct(_, _) => {
|
||||||
for field in cont.data.all_fields() {
|
for field in cont.data.all_fields() {
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
#![doc(html_root_url = "https://docs.rs/serde_derive_internals/0.22.0")]
|
#![doc(html_root_url = "https://docs.rs/serde_derive_internals/0.22.2")]
|
||||||
#![cfg_attr(feature = "cargo-clippy", allow(cyclomatic_complexity, doc_markdown, match_same_arms,
|
#![cfg_attr(feature = "cargo-clippy", allow(cyclomatic_complexity, doc_markdown, match_same_arms,
|
||||||
redundant_field_names))]
|
redundant_field_names))]
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "serde_test"
|
name = "serde_test"
|
||||||
version = "1.0.34" # remember to update html_root_url
|
version = "1.0.36" # remember to update html_root_url
|
||||||
authors = ["Erick Tryzelaar <erick.tryzelaar@gmail.com>", "David Tolnay <dtolnay@gmail.com>"]
|
authors = ["Erick Tryzelaar <erick.tryzelaar@gmail.com>", "David Tolnay <dtolnay@gmail.com>"]
|
||||||
license = "MIT/Apache-2.0"
|
license = "MIT/Apache-2.0"
|
||||||
description = "Token De/Serializer for testing De/Serialize implementations"
|
description = "Token De/Serializer for testing De/Serialize implementations"
|
||||||
|
|||||||
@@ -155,7 +155,7 @@
|
|||||||
//! # }
|
//! # }
|
||||||
//! ```
|
//! ```
|
||||||
|
|
||||||
#![doc(html_root_url = "https://docs.rs/serde_test/1.0.34")]
|
#![doc(html_root_url = "https://docs.rs/serde_test/1.0.36")]
|
||||||
#![cfg_attr(feature = "cargo-clippy", deny(clippy, clippy_pedantic))]
|
#![cfg_attr(feature = "cargo-clippy", deny(clippy, clippy_pedantic))]
|
||||||
// Whitelisted clippy lints
|
// Whitelisted clippy lints
|
||||||
#![cfg_attr(feature = "cargo-clippy", allow(float_cmp))]
|
#![cfg_attr(feature = "cargo-clippy", allow(float_cmp))]
|
||||||
|
|||||||
@@ -1,21 +0,0 @@
|
|||||||
// Copyright 2018 Serde Developers
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
||||||
// option. This file may not be copied, modified, or distributed
|
|
||||||
// except according to those terms.
|
|
||||||
|
|
||||||
#[macro_use]
|
|
||||||
extern crate serde_derive;
|
|
||||||
|
|
||||||
#[derive(Serialize)] //~ ERROR: proc-macro derive panicked
|
|
||||||
//~^ HELP: unknown serde variant attribute `flatten`
|
|
||||||
enum Foo {
|
|
||||||
#[serde(flatten)]
|
|
||||||
Foo {
|
|
||||||
x: u32,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn main() {}
|
|
||||||
@@ -385,6 +385,10 @@ fn test_gen() {
|
|||||||
s: vis::S,
|
s: vis::S,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Serialize, Deserialize)]
|
||||||
|
#[serde(remote = "Self")]
|
||||||
|
struct RemoteSelf;
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize)]
|
#[derive(Serialize, Deserialize)]
|
||||||
enum ExternallyTaggedVariantWith {
|
enum ExternallyTaggedVariantWith {
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
|
|||||||
Reference in New Issue
Block a user