mirror of
https://github.com/pezkuwichain/serde.git
synced 2026-04-28 13:47:57 +00:00
Compare commits
17 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| e94fc65f01 | |||
| b908487476 | |||
| 2a7c7faeb4 | |||
| e302e15eea | |||
| 1cbea892cf | |||
| 37a32857a2 | |||
| 8c4aad3a59 | |||
| 1774794b19 | |||
| 1af23f1f2d | |||
| 94fbc3d388 | |||
| 8da2058e2a | |||
| 09993a904a | |||
| 5d1403461c | |||
| ddc1ee564b | |||
| 00a54b848a | |||
| dad15b9fd0 | |||
| d89c19f903 |
+25
-11
@@ -18,7 +18,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
timeout-minutes: 45
|
timeout-minutes: 45
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- uses: dtolnay/rust-toolchain@nightly
|
- uses: dtolnay/rust-toolchain@nightly
|
||||||
- run: cd test_suite && cargo test --features unstable
|
- run: cd test_suite && cargo test --features unstable
|
||||||
|
|
||||||
@@ -27,7 +27,7 @@ jobs:
|
|||||||
runs-on: windows-latest
|
runs-on: windows-latest
|
||||||
timeout-minutes: 45
|
timeout-minutes: 45
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- uses: dtolnay/rust-toolchain@nightly
|
- uses: dtolnay/rust-toolchain@nightly
|
||||||
- run: cd test_suite && cargo test --features unstable -- --skip ui --exact
|
- run: cd test_suite && cargo test --features unstable -- --skip ui --exact
|
||||||
|
|
||||||
@@ -40,7 +40,7 @@ jobs:
|
|||||||
rust: [stable, beta]
|
rust: [stable, beta]
|
||||||
timeout-minutes: 45
|
timeout-minutes: 45
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- uses: dtolnay/rust-toolchain@master
|
- uses: dtolnay/rust-toolchain@master
|
||||||
with:
|
with:
|
||||||
toolchain: ${{matrix.rust}}
|
toolchain: ${{matrix.rust}}
|
||||||
@@ -56,7 +56,7 @@ jobs:
|
|||||||
os: [ubuntu, windows]
|
os: [ubuntu, windows]
|
||||||
timeout-minutes: 45
|
timeout-minutes: 45
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- uses: dtolnay/rust-toolchain@nightly
|
- uses: dtolnay/rust-toolchain@nightly
|
||||||
- run: cd serde && cargo build
|
- run: cd serde && cargo build
|
||||||
- run: cd serde && cargo build --no-default-features
|
- run: cd serde && cargo build --no-default-features
|
||||||
@@ -80,7 +80,7 @@ jobs:
|
|||||||
rust: [1.31.0, 1.34.0]
|
rust: [1.31.0, 1.34.0]
|
||||||
timeout-minutes: 45
|
timeout-minutes: 45
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- uses: dtolnay/rust-toolchain@master
|
- uses: dtolnay/rust-toolchain@master
|
||||||
with:
|
with:
|
||||||
toolchain: ${{matrix.rust}}
|
toolchain: ${{matrix.rust}}
|
||||||
@@ -93,7 +93,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
timeout-minutes: 45
|
timeout-minutes: 45
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- uses: dtolnay/rust-toolchain@1.56.0
|
- uses: dtolnay/rust-toolchain@1.56.0
|
||||||
- run: cd serde && cargo check --no-default-features
|
- run: cd serde && cargo check --no-default-features
|
||||||
- run: cd serde && cargo check
|
- run: cd serde && cargo check
|
||||||
@@ -104,7 +104,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
timeout-minutes: 45
|
timeout-minutes: 45
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- uses: dtolnay/rust-toolchain@1.36.0
|
- uses: dtolnay/rust-toolchain@1.36.0
|
||||||
- run: cd serde && cargo build --no-default-features --features alloc
|
- run: cd serde && cargo build --no-default-features --features alloc
|
||||||
|
|
||||||
@@ -113,18 +113,32 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
timeout-minutes: 45
|
timeout-minutes: 45
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- uses: dtolnay/rust-toolchain@nightly
|
- uses: dtolnay/rust-toolchain@nightly
|
||||||
- run: cargo generate-lockfile -Z minimal-versions
|
- run: cargo generate-lockfile -Z minimal-versions
|
||||||
- run: cargo check --locked --workspace
|
- run: cargo check --locked --workspace
|
||||||
|
|
||||||
|
doc:
|
||||||
|
name: Documentation
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
timeout-minutes: 45
|
||||||
|
env:
|
||||||
|
RUSTDOCFLAGS: -Dwarnings
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- uses: dtolnay/rust-toolchain@nightly
|
||||||
|
- uses: dtolnay/install@cargo-docs-rs
|
||||||
|
- run: cargo docs-rs -p serde
|
||||||
|
- run: cargo docs-rs -p serde_derive
|
||||||
|
- run: cargo docs-rs -p serde_derive_internals
|
||||||
|
|
||||||
clippy:
|
clippy:
|
||||||
name: Clippy
|
name: Clippy
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
if: github.event_name != 'pull_request'
|
if: github.event_name != 'pull_request'
|
||||||
timeout-minutes: 45
|
timeout-minutes: 45
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- uses: dtolnay/rust-toolchain@clippy
|
- uses: dtolnay/rust-toolchain@clippy
|
||||||
- run: cd serde && cargo clippy --features rc,unstable -- -Dclippy::all -Dclippy::pedantic
|
- run: cd serde && cargo clippy --features rc,unstable -- -Dclippy::all -Dclippy::pedantic
|
||||||
- run: cd serde_derive && cargo clippy -- -Dclippy::all -Dclippy::pedantic
|
- run: cd serde_derive && cargo clippy -- -Dclippy::all -Dclippy::pedantic
|
||||||
@@ -137,7 +151,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
timeout-minutes: 45
|
timeout-minutes: 45
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- uses: dtolnay/rust-toolchain@miri
|
- uses: dtolnay/rust-toolchain@miri
|
||||||
- run: cargo miri setup
|
- run: cargo miri setup
|
||||||
- run: cd serde && cargo miri test --features derive,rc,unstable
|
- run: cd serde && cargo miri test --features derive,rc,unstable
|
||||||
@@ -153,6 +167,6 @@ jobs:
|
|||||||
if: github.event_name != 'pull_request'
|
if: github.event_name != 'pull_request'
|
||||||
timeout-minutes: 45
|
timeout-minutes: 45
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- uses: dtolnay/install@cargo-outdated
|
- uses: dtolnay/install@cargo-outdated
|
||||||
- run: cargo outdated --workspace --exit-code 1
|
- run: cargo outdated --workspace --exit-code 1
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ members = [
|
|||||||
"serde_derive_internals",
|
"serde_derive_internals",
|
||||||
"test_suite",
|
"test_suite",
|
||||||
]
|
]
|
||||||
resolver = "2"
|
|
||||||
|
|
||||||
[patch.crates-io]
|
[patch.crates-io]
|
||||||
serde = { path = "serde" }
|
serde = { path = "serde" }
|
||||||
|
|||||||
+2
-2
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "serde"
|
name = "serde"
|
||||||
version = "1.0.187" # remember to update html_root_url and serde_derive dependency
|
version = "1.0.189" # remember to update html_root_url and serde_derive dependency
|
||||||
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 = ["--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.187", path = "../serde_derive" }
|
serde_derive = { version = "=1.0.189", path = "../serde_derive" }
|
||||||
|
|
||||||
|
|
||||||
### FEATURES #################################################################
|
### FEATURES #################################################################
|
||||||
|
|||||||
+3
-1
@@ -63,6 +63,7 @@
|
|||||||
//! and from DynamoDB.
|
//! and from DynamoDB.
|
||||||
//! - [Hjson], a syntax extension to JSON designed around human reading and
|
//! - [Hjson], a syntax extension to JSON designed around human reading and
|
||||||
//! editing. *(deserialization only)*
|
//! editing. *(deserialization only)*
|
||||||
|
//! - [CSV], Comma-separated values is a tabular text file format.
|
||||||
//!
|
//!
|
||||||
//! [JSON]: https://github.com/serde-rs/json
|
//! [JSON]: https://github.com/serde-rs/json
|
||||||
//! [Postcard]: https://github.com/jamesmunns/postcard
|
//! [Postcard]: https://github.com/jamesmunns/postcard
|
||||||
@@ -89,11 +90,12 @@
|
|||||||
//! [DynamoDB Items]: https://docs.rs/serde_dynamo
|
//! [DynamoDB Items]: https://docs.rs/serde_dynamo
|
||||||
//! [rusoto_dynamodb]: https://docs.rs/rusoto_dynamodb
|
//! [rusoto_dynamodb]: https://docs.rs/rusoto_dynamodb
|
||||||
//! [Hjson]: https://github.com/Canop/deser-hjson
|
//! [Hjson]: https://github.com/Canop/deser-hjson
|
||||||
|
//! [CSV]: https://docs.rs/csv
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
// 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.187")]
|
#![doc(html_root_url = "https://docs.rs/serde/1.0.189")]
|
||||||
// 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
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "serde_derive"
|
name = "serde_derive"
|
||||||
version = "1.0.187" # remember to update html_root_url
|
version = "1.0.189" # 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>"]
|
||||||
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)]"
|
||||||
|
|||||||
+13
-1
@@ -1737,7 +1737,6 @@ fn deserialize_untagged_enum_after(
|
|||||||
quote!(__deserializer),
|
quote!(__deserializer),
|
||||||
))
|
))
|
||||||
});
|
});
|
||||||
let attempts = first_attempt.into_iter().chain(attempts);
|
|
||||||
// TODO this message could be better by saving the errors from the failed
|
// TODO this message could be better by saving the errors from the failed
|
||||||
// attempts. The heuristic used by TOML was to count the number of fields
|
// attempts. The heuristic used by TOML was to count the number of fields
|
||||||
// processed before an error, and use the error that happened after the
|
// processed before an error, and use the error that happened after the
|
||||||
@@ -1750,10 +1749,23 @@ fn deserialize_untagged_enum_after(
|
|||||||
);
|
);
|
||||||
let fallthrough_msg = cattrs.expecting().unwrap_or(&fallthrough_msg);
|
let fallthrough_msg = cattrs.expecting().unwrap_or(&fallthrough_msg);
|
||||||
|
|
||||||
|
// Ignore any error associated with non-untagged deserialization so that we
|
||||||
|
// can fall through to the untagged variants. This may be infallible so we
|
||||||
|
// need to provide the error type.
|
||||||
|
let first_attempt = first_attempt.map(|expr| {
|
||||||
|
quote! {
|
||||||
|
if let _serde::__private::Result::<_, __D::Error>::Ok(__ok) = (|| #expr)() {
|
||||||
|
return _serde::__private::Ok(__ok);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
quote_block! {
|
quote_block! {
|
||||||
let __content = <_serde::__private::de::Content as _serde::Deserialize>::deserialize(__deserializer)?;
|
let __content = <_serde::__private::de::Content as _serde::Deserialize>::deserialize(__deserializer)?;
|
||||||
let __deserializer = _serde::__private::de::ContentRefDeserializer::<__D::Error>::new(&__content);
|
let __deserializer = _serde::__private::de::ContentRefDeserializer::<__D::Error>::new(&__content);
|
||||||
|
|
||||||
|
#first_attempt
|
||||||
|
|
||||||
#(
|
#(
|
||||||
if let _serde::__private::Ok(__ok) = #attempts {
|
if let _serde::__private::Ok(__ok) = #attempts {
|
||||||
return _serde::__private::Ok(__ok);
|
return _serde::__private::Ok(__ok);
|
||||||
|
|||||||
@@ -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.187")]
|
#![doc(html_root_url = "https://docs.rs/serde_derive/1.0.189")]
|
||||||
// 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
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "serde_derive_internals"
|
name = "serde_derive_internals"
|
||||||
version = "0.28.0" # remember to update html_root_url
|
version = "0.29.0" # 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>"]
|
||||||
description = "AST representation used by Serde derive macros. Unstable."
|
description = "AST representation used by Serde derive macros. Unstable."
|
||||||
documentation = "https://docs.rs/serde_derive_internals"
|
documentation = "https://docs.rs/serde_derive_internals"
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#![doc(html_root_url = "https://docs.rs/serde_derive_internals/0.28.0")]
|
#![doc(html_root_url = "https://docs.rs/serde_derive_internals/0.29.0")]
|
||||||
// Ignored clippy lints
|
// Ignored clippy lints
|
||||||
#![allow(
|
#![allow(
|
||||||
clippy::cognitive_complexity,
|
clippy::cognitive_complexity,
|
||||||
|
|||||||
@@ -2380,6 +2380,68 @@ fn test_partially_untagged_enum_desugared() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_partially_untagged_internally_tagged_enum() {
|
||||||
|
#[derive(Serialize, Deserialize, PartialEq, Debug)]
|
||||||
|
#[serde(tag = "t")]
|
||||||
|
enum Data {
|
||||||
|
A,
|
||||||
|
B,
|
||||||
|
#[serde(untagged)]
|
||||||
|
Var(u32),
|
||||||
|
}
|
||||||
|
|
||||||
|
let data = Data::A;
|
||||||
|
|
||||||
|
assert_de_tokens(
|
||||||
|
&data,
|
||||||
|
&[
|
||||||
|
Token::Map { len: None },
|
||||||
|
Token::Str("t"),
|
||||||
|
Token::Str("A"),
|
||||||
|
Token::MapEnd,
|
||||||
|
],
|
||||||
|
);
|
||||||
|
|
||||||
|
let data = Data::Var(42);
|
||||||
|
|
||||||
|
assert_de_tokens(&data, &[Token::U32(42)]);
|
||||||
|
|
||||||
|
// TODO test error output
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_partially_untagged_adjacently_tagged_enum() {
|
||||||
|
#[derive(Serialize, Deserialize, PartialEq, Debug)]
|
||||||
|
#[serde(tag = "t", content = "c")]
|
||||||
|
enum Data {
|
||||||
|
A(u32),
|
||||||
|
B,
|
||||||
|
#[serde(untagged)]
|
||||||
|
Var(u32),
|
||||||
|
}
|
||||||
|
|
||||||
|
let data = Data::A(7);
|
||||||
|
|
||||||
|
assert_de_tokens(
|
||||||
|
&data,
|
||||||
|
&[
|
||||||
|
Token::Map { len: None },
|
||||||
|
Token::Str("t"),
|
||||||
|
Token::Str("A"),
|
||||||
|
Token::Str("c"),
|
||||||
|
Token::U32(7),
|
||||||
|
Token::MapEnd,
|
||||||
|
],
|
||||||
|
);
|
||||||
|
|
||||||
|
let data = Data::Var(42);
|
||||||
|
|
||||||
|
assert_de_tokens(&data, &[Token::U32(42)]);
|
||||||
|
|
||||||
|
// TODO test error output
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_flatten_option() {
|
fn test_flatten_option() {
|
||||||
#[derive(Serialize, Deserialize, PartialEq, Debug)]
|
#[derive(Serialize, Deserialize, PartialEq, Debug)]
|
||||||
@@ -2719,7 +2781,7 @@ fn test_expecting_message_externally_tagged_enum() {
|
|||||||
// Check that #[serde(expecting = "...")] doesn't affect variant identifier error message
|
// Check that #[serde(expecting = "...")] doesn't affect variant identifier error message
|
||||||
assert_de_tokens_error::<Enum>(
|
assert_de_tokens_error::<Enum>(
|
||||||
&[Token::Enum { name: "Enum" }, Token::Unit],
|
&[Token::Enum { name: "Enum" }, Token::Unit],
|
||||||
r#"invalid type: unit value, expected variant identifier"#,
|
"invalid type: unit value, expected variant identifier",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2740,7 +2802,7 @@ fn test_expecting_message_internally_tagged_enum() {
|
|||||||
// Check that #[serde(expecting = "...")] doesn't affect variant identifier error message
|
// Check that #[serde(expecting = "...")] doesn't affect variant identifier error message
|
||||||
assert_de_tokens_error::<Enum>(
|
assert_de_tokens_error::<Enum>(
|
||||||
&[Token::Map { len: None }, Token::Str("tag"), Token::Unit],
|
&[Token::Map { len: None }, Token::Str("tag"), Token::Unit],
|
||||||
r#"invalid type: unit value, expected variant identifier"#,
|
"invalid type: unit value, expected variant identifier",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2766,7 +2828,7 @@ fn test_expecting_message_adjacently_tagged_enum() {
|
|||||||
// Check that #[serde(expecting = "...")] doesn't affect variant identifier error message
|
// Check that #[serde(expecting = "...")] doesn't affect variant identifier error message
|
||||||
assert_de_tokens_error::<Enum>(
|
assert_de_tokens_error::<Enum>(
|
||||||
&[Token::Map { len: None }, Token::Str("tag"), Token::Unit],
|
&[Token::Map { len: None }, Token::Str("tag"), Token::Unit],
|
||||||
r#"invalid type: unit value, expected variant of enum Enum"#,
|
"invalid type: unit value, expected variant of enum Enum",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2779,7 +2841,7 @@ fn test_expecting_message_untagged_tagged_enum() {
|
|||||||
Untagged,
|
Untagged,
|
||||||
}
|
}
|
||||||
|
|
||||||
assert_de_tokens_error::<Enum>(&[Token::Str("Untagged")], r#"something strange..."#);
|
assert_de_tokens_error::<Enum>(&[Token::Str("Untagged")], "something strange...");
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@@ -2800,7 +2862,7 @@ fn test_expecting_message_identifier_enum() {
|
|||||||
|
|
||||||
assert_de_tokens_error::<FieldEnum>(
|
assert_de_tokens_error::<FieldEnum>(
|
||||||
&[Token::Unit],
|
&[Token::Unit],
|
||||||
r#"invalid type: unit value, expected something strange..."#,
|
"invalid type: unit value, expected something strange...",
|
||||||
);
|
);
|
||||||
|
|
||||||
assert_de_tokens_error::<FieldEnum>(
|
assert_de_tokens_error::<FieldEnum>(
|
||||||
@@ -2809,12 +2871,12 @@ fn test_expecting_message_identifier_enum() {
|
|||||||
Token::Str("Unknown"),
|
Token::Str("Unknown"),
|
||||||
Token::None,
|
Token::None,
|
||||||
],
|
],
|
||||||
r#"invalid type: map, expected something strange..."#,
|
"invalid type: map, expected something strange...",
|
||||||
);
|
);
|
||||||
|
|
||||||
assert_de_tokens_error::<VariantEnum>(
|
assert_de_tokens_error::<VariantEnum>(
|
||||||
&[Token::Unit],
|
&[Token::Unit],
|
||||||
r#"invalid type: unit value, expected something strange..."#,
|
"invalid type: unit value, expected something strange...",
|
||||||
);
|
);
|
||||||
|
|
||||||
assert_de_tokens_error::<VariantEnum>(
|
assert_de_tokens_error::<VariantEnum>(
|
||||||
@@ -2825,7 +2887,7 @@ fn test_expecting_message_identifier_enum() {
|
|||||||
Token::Str("Unknown"),
|
Token::Str("Unknown"),
|
||||||
Token::None,
|
Token::None,
|
||||||
],
|
],
|
||||||
r#"invalid type: map, expected something strange..."#,
|
"invalid type: map, expected something strange...",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,10 +2,12 @@ error[E0609]: no field `b` on type `&remote::S`
|
|||||||
--> tests/ui/remote/unknown_field.rs:12:5
|
--> tests/ui/remote/unknown_field.rs:12:5
|
||||||
|
|
|
|
||||||
12 | b: u8,
|
12 | b: u8,
|
||||||
| ^ help: a field with a similar name exists: `a`
|
| ^ unknown field
|
||||||
|
|
||||||
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
|
||||||
|
|
|
|
||||||
12 | b: u8,
|
12 | b: u8,
|
||||||
| ^ help: a field with a similar name exists: `a`
|
| ^ `remote::S` does not have this field
|
||||||
|
|
|
||||||
|
= note: all struct fields are already assigned
|
||||||
|
|||||||
Reference in New Issue
Block a user