mirror of
https://github.com/pezkuwichain/serde.git
synced 2026-04-29 15:17:55 +00:00
Compare commits
13 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| d2d977a6c6 | |||
| a9a6ee9d7f | |||
| 28c5d215c1 | |||
| 3d6a789562 | |||
| a0e68698e3 | |||
| 44613c7d01 | |||
| c706281df3 | |||
| 65d75b8fe3 | |||
| 332b0cba40 | |||
| 8c4af41296 | |||
| 24a78f071b | |||
| c91c33436d | |||
| 2083f43a28 |
+2
-2
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "serde"
|
name = "serde"
|
||||||
version = "1.0.192"
|
version = "1.0.194"
|
||||||
authors = ["Erick Tryzelaar <erick.tryzelaar@gmail.com>", "David Tolnay <dtolnay@gmail.com>"]
|
authors = ["Erick Tryzelaar <erick.tryzelaar@gmail.com>", "David Tolnay <dtolnay@gmail.com>"]
|
||||||
build = "build.rs"
|
build = "build.rs"
|
||||||
categories = ["encoding", "no-std", "no-std::no-alloc"]
|
categories = ["encoding", "no-std", "no-std::no-alloc"]
|
||||||
@@ -37,7 +37,7 @@ rustdoc-args = ["--cfg", "doc_cfg", "--generate-link-to-definition"]
|
|||||||
# is compatible with exactly one serde release because the generated code
|
# is compatible with exactly one serde release because the generated code
|
||||||
# involves nonpublic APIs which are not bound by semver.
|
# involves nonpublic APIs which are not bound by semver.
|
||||||
[target.'cfg(any())'.dependencies]
|
[target.'cfg(any())'.dependencies]
|
||||||
serde_derive = { version = "=1.0.192", path = "../serde_derive" }
|
serde_derive = { version = "=1.0.194", path = "../serde_derive" }
|
||||||
|
|
||||||
|
|
||||||
### FEATURES #################################################################
|
### FEATURES #################################################################
|
||||||
|
|||||||
+140
-140
@@ -2526,144 +2526,6 @@ mod range_from {
|
|||||||
|
|
||||||
use crate::de::{Deserialize, Deserializer, Error, MapAccess, SeqAccess, Visitor};
|
use crate::de::{Deserialize, Deserializer, Error, MapAccess, SeqAccess, Visitor};
|
||||||
|
|
||||||
pub const FIELDS: &[&str] = &["end"];
|
|
||||||
|
|
||||||
// If this were outside of the serde crate, it would just use:
|
|
||||||
//
|
|
||||||
// #[derive(Deserialize)]
|
|
||||||
// #[serde(field_identifier, rename_all = "lowercase")]
|
|
||||||
enum Field {
|
|
||||||
End,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'de> Deserialize<'de> for Field {
|
|
||||||
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
|
|
||||||
where
|
|
||||||
D: Deserializer<'de>,
|
|
||||||
{
|
|
||||||
struct FieldVisitor;
|
|
||||||
|
|
||||||
impl<'de> Visitor<'de> for FieldVisitor {
|
|
||||||
type Value = Field;
|
|
||||||
|
|
||||||
fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
|
|
||||||
formatter.write_str("`end`")
|
|
||||||
}
|
|
||||||
|
|
||||||
fn visit_str<E>(self, value: &str) -> Result<Self::Value, E>
|
|
||||||
where
|
|
||||||
E: Error,
|
|
||||||
{
|
|
||||||
match value {
|
|
||||||
"end" => Ok(Field::End),
|
|
||||||
_ => Err(Error::unknown_field(value, FIELDS)),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn visit_bytes<E>(self, value: &[u8]) -> Result<Self::Value, E>
|
|
||||||
where
|
|
||||||
E: Error,
|
|
||||||
{
|
|
||||||
match value {
|
|
||||||
b"end" => Ok(Field::End),
|
|
||||||
_ => {
|
|
||||||
let value = crate::__private::from_utf8_lossy(value);
|
|
||||||
Err(Error::unknown_field(&*value, FIELDS))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
deserializer.deserialize_identifier(FieldVisitor)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub struct RangeFromVisitor<Idx> {
|
|
||||||
pub expecting: &'static str,
|
|
||||||
pub phantom: PhantomData<Idx>,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'de, Idx> Visitor<'de> for RangeFromVisitor<Idx>
|
|
||||||
where
|
|
||||||
Idx: Deserialize<'de>,
|
|
||||||
{
|
|
||||||
type Value = Idx;
|
|
||||||
|
|
||||||
fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
|
|
||||||
formatter.write_str(self.expecting)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn visit_seq<A>(self, mut seq: A) -> Result<Self::Value, A::Error>
|
|
||||||
where
|
|
||||||
A: SeqAccess<'de>,
|
|
||||||
{
|
|
||||||
let end: Idx = match tri!(seq.next_element()) {
|
|
||||||
Some(value) => value,
|
|
||||||
None => {
|
|
||||||
return Err(Error::invalid_length(0, &self));
|
|
||||||
}
|
|
||||||
};
|
|
||||||
Ok(end)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn visit_map<A>(self, mut map: A) -> Result<Self::Value, A::Error>
|
|
||||||
where
|
|
||||||
A: MapAccess<'de>,
|
|
||||||
{
|
|
||||||
let mut end: Option<Idx> = None;
|
|
||||||
while let Some(key) = tri!(map.next_key()) {
|
|
||||||
match key {
|
|
||||||
Field::End => {
|
|
||||||
if end.is_some() {
|
|
||||||
return Err(<A::Error as Error>::duplicate_field("end"));
|
|
||||||
}
|
|
||||||
end = Some(tri!(map.next_value()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
let end = match end {
|
|
||||||
Some(end) => end,
|
|
||||||
None => return Err(<A::Error as Error>::missing_field("end")),
|
|
||||||
};
|
|
||||||
Ok(end)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
// Similar to:
|
|
||||||
//
|
|
||||||
// #[derive(Deserialize)]
|
|
||||||
// #[serde(deny_unknown_fields)]
|
|
||||||
// struct RangeTo<Idx> {
|
|
||||||
// start: Idx,
|
|
||||||
// }
|
|
||||||
impl<'de, Idx> Deserialize<'de> for RangeTo<Idx>
|
|
||||||
where
|
|
||||||
Idx: Deserialize<'de>,
|
|
||||||
{
|
|
||||||
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
|
|
||||||
where
|
|
||||||
D: Deserializer<'de>,
|
|
||||||
{
|
|
||||||
let end = tri!(deserializer.deserialize_struct(
|
|
||||||
"RangeTo",
|
|
||||||
range_to::FIELDS,
|
|
||||||
range_to::RangeToVisitor {
|
|
||||||
expecting: "struct RangeTo",
|
|
||||||
phantom: PhantomData,
|
|
||||||
},
|
|
||||||
));
|
|
||||||
Ok(..end)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
mod range_to {
|
|
||||||
use crate::lib::*;
|
|
||||||
|
|
||||||
use crate::de::{Deserialize, Deserializer, Error, MapAccess, SeqAccess, Visitor};
|
|
||||||
|
|
||||||
pub const FIELDS: &[&str] = &["start"];
|
pub const FIELDS: &[&str] = &["start"];
|
||||||
|
|
||||||
// If this were outside of the serde crate, it would just use:
|
// If this were outside of the serde crate, it would just use:
|
||||||
@@ -2716,12 +2578,12 @@ mod range_to {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct RangeToVisitor<Idx> {
|
pub struct RangeFromVisitor<Idx> {
|
||||||
pub expecting: &'static str,
|
pub expecting: &'static str,
|
||||||
pub phantom: PhantomData<Idx>,
|
pub phantom: PhantomData<Idx>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'de, Idx> Visitor<'de> for RangeToVisitor<Idx>
|
impl<'de, Idx> Visitor<'de> for RangeFromVisitor<Idx>
|
||||||
where
|
where
|
||||||
Idx: Deserialize<'de>,
|
Idx: Deserialize<'de>,
|
||||||
{
|
{
|
||||||
@@ -2770,6 +2632,144 @@ mod range_to {
|
|||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
// Similar to:
|
||||||
|
//
|
||||||
|
// #[derive(Deserialize)]
|
||||||
|
// #[serde(deny_unknown_fields)]
|
||||||
|
// struct RangeTo<Idx> {
|
||||||
|
// end: Idx,
|
||||||
|
// }
|
||||||
|
impl<'de, Idx> Deserialize<'de> for RangeTo<Idx>
|
||||||
|
where
|
||||||
|
Idx: Deserialize<'de>,
|
||||||
|
{
|
||||||
|
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
|
||||||
|
where
|
||||||
|
D: Deserializer<'de>,
|
||||||
|
{
|
||||||
|
let end = tri!(deserializer.deserialize_struct(
|
||||||
|
"RangeTo",
|
||||||
|
range_to::FIELDS,
|
||||||
|
range_to::RangeToVisitor {
|
||||||
|
expecting: "struct RangeTo",
|
||||||
|
phantom: PhantomData,
|
||||||
|
},
|
||||||
|
));
|
||||||
|
Ok(..end)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
mod range_to {
|
||||||
|
use crate::lib::*;
|
||||||
|
|
||||||
|
use crate::de::{Deserialize, Deserializer, Error, MapAccess, SeqAccess, Visitor};
|
||||||
|
|
||||||
|
pub const FIELDS: &[&str] = &["end"];
|
||||||
|
|
||||||
|
// If this were outside of the serde crate, it would just use:
|
||||||
|
//
|
||||||
|
// #[derive(Deserialize)]
|
||||||
|
// #[serde(field_identifier, rename_all = "lowercase")]
|
||||||
|
enum Field {
|
||||||
|
End,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<'de> Deserialize<'de> for Field {
|
||||||
|
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
|
||||||
|
where
|
||||||
|
D: Deserializer<'de>,
|
||||||
|
{
|
||||||
|
struct FieldVisitor;
|
||||||
|
|
||||||
|
impl<'de> Visitor<'de> for FieldVisitor {
|
||||||
|
type Value = Field;
|
||||||
|
|
||||||
|
fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
|
||||||
|
formatter.write_str("`end`")
|
||||||
|
}
|
||||||
|
|
||||||
|
fn visit_str<E>(self, value: &str) -> Result<Self::Value, E>
|
||||||
|
where
|
||||||
|
E: Error,
|
||||||
|
{
|
||||||
|
match value {
|
||||||
|
"end" => Ok(Field::End),
|
||||||
|
_ => Err(Error::unknown_field(value, FIELDS)),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn visit_bytes<E>(self, value: &[u8]) -> Result<Self::Value, E>
|
||||||
|
where
|
||||||
|
E: Error,
|
||||||
|
{
|
||||||
|
match value {
|
||||||
|
b"end" => Ok(Field::End),
|
||||||
|
_ => {
|
||||||
|
let value = crate::__private::from_utf8_lossy(value);
|
||||||
|
Err(Error::unknown_field(&*value, FIELDS))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
deserializer.deserialize_identifier(FieldVisitor)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct RangeToVisitor<Idx> {
|
||||||
|
pub expecting: &'static str,
|
||||||
|
pub phantom: PhantomData<Idx>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<'de, Idx> Visitor<'de> for RangeToVisitor<Idx>
|
||||||
|
where
|
||||||
|
Idx: Deserialize<'de>,
|
||||||
|
{
|
||||||
|
type Value = Idx;
|
||||||
|
|
||||||
|
fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
|
||||||
|
formatter.write_str(self.expecting)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn visit_seq<A>(self, mut seq: A) -> Result<Self::Value, A::Error>
|
||||||
|
where
|
||||||
|
A: SeqAccess<'de>,
|
||||||
|
{
|
||||||
|
let end: Idx = match tri!(seq.next_element()) {
|
||||||
|
Some(value) => value,
|
||||||
|
None => {
|
||||||
|
return Err(Error::invalid_length(0, &self));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
Ok(end)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn visit_map<A>(self, mut map: A) -> Result<Self::Value, A::Error>
|
||||||
|
where
|
||||||
|
A: MapAccess<'de>,
|
||||||
|
{
|
||||||
|
let mut end: Option<Idx> = None;
|
||||||
|
while let Some(key) = tri!(map.next_key()) {
|
||||||
|
match key {
|
||||||
|
Field::End => {
|
||||||
|
if end.is_some() {
|
||||||
|
return Err(<A::Error as Error>::duplicate_field("end"));
|
||||||
|
}
|
||||||
|
end = Some(tri!(map.next_value()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
let end = match end {
|
||||||
|
Some(end) => end,
|
||||||
|
None => return Err(<A::Error as Error>::missing_field("end")),
|
||||||
|
};
|
||||||
|
Ok(end)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
impl<'de, T> Deserialize<'de> for Bound<T>
|
impl<'de, T> Deserialize<'de> for Bound<T>
|
||||||
where
|
where
|
||||||
T: Deserialize<'de>,
|
T: Deserialize<'de>,
|
||||||
|
|||||||
+2
-2
@@ -64,8 +64,8 @@
|
|||||||
//! - RefCell\<T\>
|
//! - RefCell\<T\>
|
||||||
//! - Mutex\<T\>
|
//! - Mutex\<T\>
|
||||||
//! - RwLock\<T\>
|
//! - RwLock\<T\>
|
||||||
//! - Rc\<T\> *(if* features = ["rc"] *is enabled)*
|
//! - Rc\<T\> *(if* features = \["rc"\] *is enabled)*
|
||||||
//! - Arc\<T\> *(if* features = ["rc"] *is enabled)*
|
//! - Arc\<T\> *(if* features = \["rc"\] *is enabled)*
|
||||||
//! - **Collection types**:
|
//! - **Collection types**:
|
||||||
//! - BTreeMap\<K, V\>
|
//! - BTreeMap\<K, V\>
|
||||||
//! - BTreeSet\<T\>
|
//! - BTreeSet\<T\>
|
||||||
|
|||||||
+1
-2
@@ -95,7 +95,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.192")]
|
#![doc(html_root_url = "https://docs.rs/serde/1.0.194")]
|
||||||
// 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)]
|
||||||
// Show which crate feature enables conditionally compiled APIs in documentation.
|
// Show which crate feature enables conditionally compiled APIs in documentation.
|
||||||
@@ -122,7 +122,6 @@
|
|||||||
// things are often more readable this way
|
// things are often more readable this way
|
||||||
clippy::cast_lossless,
|
clippy::cast_lossless,
|
||||||
clippy::module_name_repetitions,
|
clippy::module_name_repetitions,
|
||||||
clippy::option_if_let_else,
|
|
||||||
clippy::single_match_else,
|
clippy::single_match_else,
|
||||||
clippy::type_complexity,
|
clippy::type_complexity,
|
||||||
clippy::use_self,
|
clippy::use_self,
|
||||||
|
|||||||
@@ -61,8 +61,8 @@
|
|||||||
//! - RefCell\<T\>
|
//! - RefCell\<T\>
|
||||||
//! - Mutex\<T\>
|
//! - Mutex\<T\>
|
||||||
//! - RwLock\<T\>
|
//! - RwLock\<T\>
|
||||||
//! - Rc\<T\> *(if* features = ["rc"] *is enabled)*
|
//! - Rc\<T\> *(if* features = \["rc"\] *is enabled)*
|
||||||
//! - Arc\<T\> *(if* features = ["rc"] *is enabled)*
|
//! - Arc\<T\> *(if* features = \["rc"\] *is enabled)*
|
||||||
//! - **Collection types**:
|
//! - **Collection types**:
|
||||||
//! - BTreeMap\<K, V\>
|
//! - BTreeMap\<K, V\>
|
||||||
//! - BTreeSet\<T\>
|
//! - BTreeSet\<T\>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "serde_derive"
|
name = "serde_derive"
|
||||||
version = "1.0.192"
|
version = "1.0.194"
|
||||||
authors = ["Erick Tryzelaar <erick.tryzelaar@gmail.com>", "David Tolnay <dtolnay@gmail.com>"]
|
authors = ["Erick Tryzelaar <erick.tryzelaar@gmail.com>", "David Tolnay <dtolnay@gmail.com>"]
|
||||||
categories = ["no-std", "no-std::no-alloc"]
|
categories = ["no-std", "no-std::no-alloc"]
|
||||||
description = "Macros 1.1 implementation of #[derive(Serialize, Deserialize)]"
|
description = "Macros 1.1 implementation of #[derive(Serialize, Deserialize)]"
|
||||||
@@ -21,9 +21,9 @@ name = "serde_derive"
|
|||||||
proc-macro = true
|
proc-macro = true
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
proc-macro2 = "1.0"
|
proc-macro2 = "1.0.74"
|
||||||
quote = "1.0"
|
quote = "1.0.35"
|
||||||
syn = "2.0.28"
|
syn = "2.0.46"
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
serde = { version = "1", path = "../serde" }
|
serde = { version = "1", path = "../serde" }
|
||||||
|
|||||||
@@ -13,7 +13,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.192")]
|
#![doc(html_root_url = "https://docs.rs/serde_derive/1.0.194")]
|
||||||
// Ignored clippy lints
|
// Ignored clippy lints
|
||||||
#![allow(
|
#![allow(
|
||||||
// clippy false positive: https://github.com/rust-lang/rust-clippy/issues/7054
|
// clippy false positive: https://github.com/rust-lang/rust-clippy/issues/7054
|
||||||
@@ -50,7 +50,6 @@
|
|||||||
clippy::match_wildcard_for_single_variants,
|
clippy::match_wildcard_for_single_variants,
|
||||||
clippy::module_name_repetitions,
|
clippy::module_name_repetitions,
|
||||||
clippy::must_use_candidate,
|
clippy::must_use_candidate,
|
||||||
clippy::option_if_let_else,
|
|
||||||
clippy::similar_names,
|
clippy::similar_names,
|
||||||
clippy::single_match_else,
|
clippy::single_match_else,
|
||||||
clippy::struct_excessive_bools,
|
clippy::struct_excessive_bools,
|
||||||
|
|||||||
@@ -15,9 +15,9 @@ rust-version = "1.56"
|
|||||||
path = "lib.rs"
|
path = "lib.rs"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
proc-macro2 = "1.0"
|
proc-macro2 = "1.0.74"
|
||||||
quote = "1.0"
|
quote = "1.0.35"
|
||||||
syn = { version = "2.0.28", default-features = false, features = ["clone-impls", "derive", "parsing", "printing"] }
|
syn = { version = "2.0.46", default-features = false, features = ["clone-impls", "derive", "parsing", "printing"] }
|
||||||
|
|
||||||
[package.metadata.docs.rs]
|
[package.metadata.docs.rs]
|
||||||
targets = ["x86_64-unknown-linux-gnu"]
|
targets = ["x86_64-unknown-linux-gnu"]
|
||||||
|
|||||||
@@ -1898,6 +1898,46 @@ fn test_range_inclusive() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_range_from() {
|
||||||
|
test(
|
||||||
|
1u32..,
|
||||||
|
&[
|
||||||
|
Token::Struct {
|
||||||
|
name: "RangeFrom",
|
||||||
|
len: 1,
|
||||||
|
},
|
||||||
|
Token::Str("start"),
|
||||||
|
Token::U32(1),
|
||||||
|
Token::StructEnd,
|
||||||
|
],
|
||||||
|
);
|
||||||
|
test(
|
||||||
|
1u32..,
|
||||||
|
&[Token::Seq { len: Some(1) }, Token::U32(1), Token::SeqEnd],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_range_to() {
|
||||||
|
test(
|
||||||
|
..2u32,
|
||||||
|
&[
|
||||||
|
Token::Struct {
|
||||||
|
name: "RangeTo",
|
||||||
|
len: 1,
|
||||||
|
},
|
||||||
|
Token::Str("end"),
|
||||||
|
Token::U32(2),
|
||||||
|
Token::StructEnd,
|
||||||
|
],
|
||||||
|
);
|
||||||
|
test(
|
||||||
|
..2u32,
|
||||||
|
&[Token::Seq { len: Some(1) }, Token::U32(2), Token::SeqEnd],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_bound() {
|
fn test_bound() {
|
||||||
test(
|
test(
|
||||||
|
|||||||
@@ -500,6 +500,38 @@ fn test_range_inclusive() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_range_from() {
|
||||||
|
assert_ser_tokens(
|
||||||
|
&(1u32..),
|
||||||
|
&[
|
||||||
|
Token::Struct {
|
||||||
|
name: "RangeFrom",
|
||||||
|
len: 1,
|
||||||
|
},
|
||||||
|
Token::Str("start"),
|
||||||
|
Token::U32(1),
|
||||||
|
Token::StructEnd,
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_range_to() {
|
||||||
|
assert_ser_tokens(
|
||||||
|
&(..2u32),
|
||||||
|
&[
|
||||||
|
Token::Struct {
|
||||||
|
name: "RangeTo",
|
||||||
|
len: 1,
|
||||||
|
},
|
||||||
|
Token::Str("end"),
|
||||||
|
Token::U32(2),
|
||||||
|
Token::StructEnd,
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_bound() {
|
fn test_bound() {
|
||||||
assert_ser_tokens(
|
assert_ser_tokens(
|
||||||
|
|||||||
@@ -3,6 +3,11 @@ error[E0609]: no field `b` on type `&remote::S`
|
|||||||
|
|
|
|
||||||
12 | b: u8,
|
12 | b: u8,
|
||||||
| ^ unknown field
|
| ^ unknown field
|
||||||
|
|
|
||||||
|
help: a field with a similar name exists
|
||||||
|
|
|
||||||
|
12 | a: u8,
|
||||||
|
| ~
|
||||||
|
|
||||||
error[E0560]: struct `remote::S` has no field named `b`
|
error[E0560]: struct `remote::S` has no field named `b`
|
||||||
--> tests/ui/remote/unknown_field.rs:12:5
|
--> tests/ui/remote/unknown_field.rs:12:5
|
||||||
|
|||||||
Reference in New Issue
Block a user