From b1c7db47b8f93c05d50e447517af26024d92f404 Mon Sep 17 00:00:00 2001 From: Baptiste de Montangon Date: Mon, 12 Jun 2023 15:27:28 +0200 Subject: [PATCH 1/3] Adjancently tagged enum field is determined with visit_identifier instead of only visit_str --- serde/src/private/de.rs | 50 ++- test_suite/tests/test_macros.rs | 566 +++++++++++++++++++++++++++++++- 2 files changed, 609 insertions(+), 7 deletions(-) diff --git a/serde/src/private/de.rs b/serde/src/private/de.rs index f0a0ee683..6678df252 100644 --- a/serde/src/private/de.rs +++ b/serde/src/private/de.rs @@ -915,7 +915,7 @@ mod content { where D: Deserializer<'de>, { - deserializer.deserialize_str(self) + deserializer.deserialize_identifier(self) } } @@ -923,7 +923,25 @@ mod content { type Value = TagOrContentField; fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { - write!(formatter, "{:?} or {:?}", self.tag, self.content) + write!( + formatter, + "{:?}, {:?}, b{0:?}, b{1:?}, 0 or 1", + self.tag, self.content + ) + } + + fn visit_u64(self, field_index: u64) -> Result + where + E: de::Error, + { + match field_index { + 0 => Ok(TagOrContentField::Tag), + 1 => Ok(TagOrContentField::Content), + _ => Err(de::Error::invalid_value( + Unexpected::Unsigned(field_index), + &self, + )), + } } fn visit_str(self, field: &str) -> Result @@ -938,6 +956,19 @@ mod content { Err(de::Error::invalid_value(Unexpected::Str(field), &self)) } } + + fn visit_bytes(self, field: &[u8]) -> Result + where + E: de::Error, + { + if field == self.tag.as_bytes() { + Ok(TagOrContentField::Tag) + } else if field == self.content.as_bytes() { + Ok(TagOrContentField::Content) + } else { + Err(de::Error::invalid_value(Unexpected::Bytes(field), &self)) + } + } } /// Used by generated code to deserialize an adjacently tagged enum when @@ -963,7 +994,7 @@ mod content { where D: Deserializer<'de>, { - deserializer.deserialize_str(self) + deserializer.deserialize_identifier(self) } } @@ -973,11 +1004,22 @@ mod content { fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { write!( formatter, - "{:?}, {:?}, or other ignored fields", + "{:?}, {:?}, b{0:?}, b{1:?}, 0, 1, or other ignored field identifiers", self.tag, self.content ) } + fn visit_u64(self, field_index: u64) -> Result + where + E: de::Error, + { + match field_index { + 0 => Ok(TagContentOtherField::Tag), + 1 => Ok(TagContentOtherField::Content), + _ => Ok(TagContentOtherField::Other), + } + } + fn visit_str(self, field: &str) -> Result where E: de::Error, diff --git a/test_suite/tests/test_macros.rs b/test_suite/tests/test_macros.rs index c6973db90..ba089eaa5 100644 --- a/test_suite/tests/test_macros.rs +++ b/test_suite/tests/test_macros.rs @@ -1086,6 +1086,34 @@ fn test_adjacently_tagged_enum() { ], ); + // unit with no content (integer tag) + assert_de_tokens( + &AdjacentlyTagged::Unit::, + &[ + Token::Struct { + name: "AdjacentlyTagged", + len: 2, + }, + Token::U64(0), + Token::Str("Unit"), + Token::StructEnd, + ], + ); + + // unit with no content (bytes tag) + assert_de_tokens( + &AdjacentlyTagged::Unit::, + &[ + Token::Struct { + name: "AdjacentlyTagged", + len: 2, + }, + Token::Bytes(b"t"), + Token::Str("Unit"), + Token::StructEnd, + ], + ); + // unit with tag first assert_de_tokens( &AdjacentlyTagged::Unit::, @@ -1102,6 +1130,38 @@ fn test_adjacently_tagged_enum() { ], ); + // unit with tag first (integer tag) + assert_de_tokens( + &AdjacentlyTagged::Unit::, + &[ + Token::Struct { + name: "AdjacentlyTagged", + len: 2, + }, + Token::U64(0), + Token::Str("Unit"), + Token::U64(1), + Token::Unit, + Token::StructEnd, + ], + ); + + // unit with tag first (bytes tag) + assert_de_tokens( + &AdjacentlyTagged::Unit::, + &[ + Token::Struct { + name: "AdjacentlyTagged", + len: 2, + }, + Token::Bytes(b"t"), + Token::Str("Unit"), + Token::Bytes(b"c"), + Token::Unit, + Token::StructEnd, + ], + ); + // unit with content first assert_de_tokens( &AdjacentlyTagged::Unit::, @@ -1118,6 +1178,38 @@ fn test_adjacently_tagged_enum() { ], ); + // unit with content first (integer tag) + assert_de_tokens( + &AdjacentlyTagged::Unit::, + &[ + Token::Struct { + name: "AdjacentlyTagged", + len: 2, + }, + Token::U64(1), + Token::Unit, + Token::U64(0), + Token::Str("Unit"), + Token::StructEnd, + ], + ); + + // unit with content first (bytes tag) + assert_de_tokens( + &AdjacentlyTagged::Unit::, + &[ + Token::Struct { + name: "AdjacentlyTagged", + len: 2, + }, + Token::Bytes(b"c"), + Token::Unit, + Token::Bytes(b"t"), + Token::Str("Unit"), + Token::StructEnd, + ], + ); + // unit with excess content (f, g, h) assert_de_tokens( &AdjacentlyTagged::Unit::, @@ -1140,6 +1232,50 @@ fn test_adjacently_tagged_enum() { ], ); + // unit with excess content (f, g, 3) (integer tag) + assert_de_tokens( + &AdjacentlyTagged::Unit::, + &[ + Token::Struct { + name: "AdjacentlyTagged", + len: 2, + }, + Token::Str("f"), + Token::Unit, + Token::U64(0), + Token::Str("Unit"), + Token::Str("g"), + Token::Unit, + Token::U64(1), + Token::Unit, + Token::U64(3), + Token::Unit, + Token::StructEnd, + ], + ); + + // unit with excess content (f, b"g", 3) (bytes tag) + assert_de_tokens( + &AdjacentlyTagged::Unit::, + &[ + Token::Struct { + name: "AdjacentlyTagged", + len: 2, + }, + Token::Str("f"), + Token::Unit, + Token::Bytes(b"t"), + Token::Str("Unit"), + Token::Bytes(b"g"), + Token::Unit, + Token::Str("c"), + Token::Unit, + Token::U64(3), + Token::Unit, + Token::StructEnd, + ], + ); + // newtype with tag first assert_tokens( &AdjacentlyTagged::Newtype::(1), @@ -1156,6 +1292,38 @@ fn test_adjacently_tagged_enum() { ], ); + // newtype with tag first (integer tag) + assert_de_tokens( + &AdjacentlyTagged::Newtype::(1), + &[ + Token::Struct { + name: "AdjacentlyTagged", + len: 2, + }, + Token::U64(0), + Token::Str("Newtype"), + Token::U64(1), + Token::U8(1), + Token::StructEnd, + ], + ); + + // newtype with tag first (bytes tag) + assert_de_tokens( + &AdjacentlyTagged::Newtype::(1), + &[ + Token::Struct { + name: "AdjacentlyTagged", + len: 2, + }, + Token::Bytes(b"t"), + Token::Str("Newtype"), + Token::Bytes(b"c"), + Token::U8(1), + Token::StructEnd, + ], + ); + // newtype with content first assert_de_tokens( &AdjacentlyTagged::Newtype::(1), @@ -1172,6 +1340,38 @@ fn test_adjacently_tagged_enum() { ], ); + // newtype with content first (integer tag) + assert_de_tokens( + &AdjacentlyTagged::Newtype::(1), + &[ + Token::Struct { + name: "AdjacentlyTagged", + len: 2, + }, + Token::U64(1), + Token::U8(1), + Token::U64(0), + Token::Str("Newtype"), + Token::StructEnd, + ], + ); + + // newtype with content first (bytes tag) + assert_de_tokens( + &AdjacentlyTagged::Newtype::(1), + &[ + Token::Struct { + name: "AdjacentlyTagged", + len: 2, + }, + Token::Bytes(b"c"), + Token::U8(1), + Token::Bytes(b"t"), + Token::Str("Newtype"), + Token::StructEnd, + ], + ); + // optional newtype with no content field assert_de_tokens( &AdjacentlyTagged::Newtype::>(None), @@ -1186,6 +1386,34 @@ fn test_adjacently_tagged_enum() { ], ); + // optional newtype with no content field (integer tag) + assert_de_tokens( + &AdjacentlyTagged::Newtype::>(None), + &[ + Token::Struct { + name: "AdjacentlyTagged", + len: 1, + }, + Token::U64(0), + Token::Str("Newtype"), + Token::StructEnd, + ], + ); + + // optional newtype with no content field (bytes tag) + assert_de_tokens( + &AdjacentlyTagged::Newtype::>(None), + &[ + Token::Struct { + name: "AdjacentlyTagged", + len: 1, + }, + Token::Bytes(b"t"), + Token::Str("Newtype"), + Token::StructEnd, + ], + ); + // tuple with tag first assert_tokens( &AdjacentlyTagged::Tuple::(1, 1), @@ -1205,6 +1433,44 @@ fn test_adjacently_tagged_enum() { ], ); + // tuple with tag first (integer tag) + assert_de_tokens( + &AdjacentlyTagged::Tuple::(1, 1), + &[ + Token::Struct { + name: "AdjacentlyTagged", + len: 2, + }, + Token::U64(0), + Token::Str("Tuple"), + Token::U64(1), + Token::Tuple { len: 2 }, + Token::U8(1), + Token::U8(1), + Token::TupleEnd, + Token::StructEnd, + ], + ); + + // tuple with tag first (bytes tag) + assert_de_tokens( + &AdjacentlyTagged::Tuple::(1, 1), + &[ + Token::Struct { + name: "AdjacentlyTagged", + len: 2, + }, + Token::Bytes(b"t"), + Token::Str("Tuple"), + Token::Bytes(b"c"), + Token::Tuple { len: 2 }, + Token::U8(1), + Token::U8(1), + Token::TupleEnd, + Token::StructEnd, + ], + ); + // tuple with content first assert_de_tokens( &AdjacentlyTagged::Tuple::(1, 1), @@ -1224,6 +1490,44 @@ fn test_adjacently_tagged_enum() { ], ); + // tuple with content first (integer tag) + assert_de_tokens( + &AdjacentlyTagged::Tuple::(1, 1), + &[ + Token::Struct { + name: "AdjacentlyTagged", + len: 2, + }, + Token::U64(1), + Token::Tuple { len: 2 }, + Token::U8(1), + Token::U8(1), + Token::TupleEnd, + Token::U64(0), + Token::Str("Tuple"), + Token::StructEnd, + ], + ); + + // tuple with content first (bytes tag) + assert_de_tokens( + &AdjacentlyTagged::Tuple::(1, 1), + &[ + Token::Struct { + name: "AdjacentlyTagged", + len: 2, + }, + Token::Bytes(b"c"), + Token::Tuple { len: 2 }, + Token::U8(1), + Token::U8(1), + Token::TupleEnd, + Token::Bytes(b"t"), + Token::Str("Tuple"), + Token::StructEnd, + ], + ); + // struct with tag first assert_tokens( &AdjacentlyTagged::Struct:: { f: 1 }, @@ -1246,6 +1550,50 @@ fn test_adjacently_tagged_enum() { ], ); + // struct with tag first (integer tag) + assert_de_tokens( + &AdjacentlyTagged::Struct:: { f: 1 }, + &[ + Token::Struct { + name: "AdjacentlyTagged", + len: 2, + }, + Token::U64(0), + Token::Str("Struct"), + Token::U64(1), + Token::Struct { + name: "Struct", + len: 1, + }, + Token::Str("f"), + Token::U8(1), + Token::StructEnd, + Token::StructEnd, + ], + ); + + // struct with tag first (bytes tag) + assert_de_tokens( + &AdjacentlyTagged::Struct:: { f: 1 }, + &[ + Token::Struct { + name: "AdjacentlyTagged", + len: 2, + }, + Token::Bytes(b"t"), + Token::Str("Struct"), + Token::Bytes(b"c"), + Token::Struct { + name: "Struct", + len: 1, + }, + Token::Str("f"), + Token::U8(1), + Token::StructEnd, + Token::StructEnd, + ], + ); + // struct with content first assert_de_tokens( &AdjacentlyTagged::Struct:: { f: 1 }, @@ -1267,6 +1615,50 @@ fn test_adjacently_tagged_enum() { Token::StructEnd, ], ); + + // struct with content first (integer tag) + assert_de_tokens( + &AdjacentlyTagged::Struct:: { f: 1 }, + &[ + Token::Struct { + name: "AdjacentlyTagged", + len: 2, + }, + Token::U64(1), + Token::Struct { + name: "Struct", + len: 1, + }, + Token::Str("f"), + Token::U8(1), + Token::StructEnd, + Token::U64(0), + Token::Str("Struct"), + Token::StructEnd, + ], + ); + + // struct with content first (bytes tag) + assert_de_tokens( + &AdjacentlyTagged::Struct:: { f: 1 }, + &[ + Token::Struct { + name: "AdjacentlyTagged", + len: 2, + }, + Token::Bytes(b"c"), + Token::Struct { + name: "Struct", + len: 1, + }, + Token::Str("f"), + Token::U8(1), + Token::StructEnd, + Token::Bytes(b"t"), + Token::Str("Struct"), + Token::StructEnd, + ], + ); } #[test] @@ -1292,6 +1684,126 @@ fn test_adjacently_tagged_enum_deny_unknown_fields() { ], ); + assert_de_tokens( + &AdjacentlyTagged::Unit, + &[ + Token::Struct { + name: "AdjacentlyTagged", + len: 2, + }, + Token::U64(0), + Token::Str("Unit"), + Token::U64(1), + Token::Unit, + Token::StructEnd, + ], + ); + + assert_de_tokens( + &AdjacentlyTagged::Unit, + &[ + Token::Struct { + name: "AdjacentlyTagged", + len: 2, + }, + Token::Bytes(b"t"), + Token::Str("Unit"), + Token::Bytes(b"c"), + Token::Unit, + Token::StructEnd, + ], + ); + + assert_de_tokens( + &AdjacentlyTagged::Unit, + &[ + Token::Struct { + name: "AdjacentlyTagged", + len: 2, + }, + Token::Str("t"), + Token::Str("Unit"), + Token::U64(1), + Token::Unit, + Token::StructEnd, + ], + ); + + assert_de_tokens( + &AdjacentlyTagged::Unit, + &[ + Token::Struct { + name: "AdjacentlyTagged", + len: 2, + }, + Token::U64(0), + Token::Str("Unit"), + Token::Str("c"), + Token::Unit, + Token::StructEnd, + ], + ); + + assert_de_tokens( + &AdjacentlyTagged::Unit, + &[ + Token::Struct { + name: "AdjacentlyTagged", + len: 2, + }, + Token::Bytes(b"t"), + Token::Str("Unit"), + Token::U64(1), + Token::Unit, + Token::StructEnd, + ], + ); + + assert_de_tokens( + &AdjacentlyTagged::Unit, + &[ + Token::Struct { + name: "AdjacentlyTagged", + len: 2, + }, + Token::Bytes(b"t"), + Token::Str("Unit"), + Token::Str("c"), + Token::Unit, + Token::StructEnd, + ], + ); + + assert_de_tokens( + &AdjacentlyTagged::Unit, + &[ + Token::Struct { + name: "AdjacentlyTagged", + len: 2, + }, + Token::Str("c"), + Token::Unit, + Token::Bytes(b"t"), + Token::Str("Unit"), + Token::StructEnd, + ], + ); + + assert_de_tokens( + &AdjacentlyTagged::Unit, + &[ + Token::Struct { + name: "AdjacentlyTagged", + len: 2, + }, + Token::Str("c"), + Token::Unit, + Token::Bytes(b"t"), + Token::Str("Unit"), + Token::StructEnd, + ], + ); + assert_de_tokens_error::( &[ Token::Struct { @@ -1304,7 +1816,7 @@ fn test_adjacently_tagged_enum_deny_unknown_fields() { Token::Unit, Token::Str("h"), ], - r#"invalid value: string "h", expected "t" or "c""#, + r#"invalid value: string "h", expected "t", "c", b"t", b"c", 0 or 1"#, ); assert_de_tokens_error::( @@ -1315,7 +1827,7 @@ fn test_adjacently_tagged_enum_deny_unknown_fields() { }, Token::Str("h"), ], - r#"invalid value: string "h", expected "t" or "c""#, + r#"invalid value: string "h", expected "t", "c", b"t", b"c", 0 or 1"#, ); assert_de_tokens_error::( @@ -1328,7 +1840,55 @@ fn test_adjacently_tagged_enum_deny_unknown_fields() { Token::Unit, Token::Str("h"), ], - r#"invalid value: string "h", expected "t" or "c""#, + r#"invalid value: string "h", expected "t", "c", b"t", b"c", 0 or 1"#, + ); + + assert_de_tokens_error::( + &[ + Token::Struct { + name: "AdjacentlyTagged", + len: 2, + }, + Token::U64(2), + ], + r#"invalid value: integer `2`, expected "t", "c", b"t", b"c", 0 or 1"#, + ); + + assert_de_tokens_error::( + &[ + Token::Struct { + name: "AdjacentlyTagged", + len: 2, + }, + Token::U64(0), + Token::Str("Unit"), + Token::U64(3), + ], + r#"invalid value: integer `3`, expected "t", "c", b"t", b"c", 0 or 1"#, + ); + + assert_de_tokens_error::( + &[ + Token::Struct { + name: "AdjacentlyTagged", + len: 2, + }, + Token::Bytes(b"h"), + ], + r#"invalid value: byte array, expected "t", "c", b"t", b"c", 0 or 1"#, + ); + + assert_de_tokens_error::( + &[ + Token::Struct { + name: "AdjacentlyTagged", + len: 2, + }, + Token::Bytes(b"c"), + Token::Unit, + Token::Bytes(b"h"), + ], + r#"invalid value: byte array, expected "t", "c", b"t", b"c", 0 or 1"#, ); } From 9fef892f6dafc6759a83852bf73f5b86c46487d1 Mon Sep 17 00:00:00 2001 From: Baptiste de Montangon Date: Mon, 12 Jun 2023 16:02:19 +0200 Subject: [PATCH 2/3] fixed difference in error message for adjacently tagged enums --- test_suite/tests/test_annotations.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test_suite/tests/test_annotations.rs b/test_suite/tests/test_annotations.rs index 698be4ed1..70e239619 100644 --- a/test_suite/tests/test_annotations.rs +++ b/test_suite/tests/test_annotations.rs @@ -3022,7 +3022,7 @@ fn test_expecting_message_adjacently_tagged_enum() { assert_de_tokens_error::( &[Token::Map { len: None }, Token::Unit], - r#"invalid type: unit value, expected "tag", "content", or other ignored fields"#, + r#"invalid type: unit value, expected "tag", "content", b"tag", b"content", 0, 1, or other ignored field identifiers"#, ); // Check that #[serde(expecting = "...")] doesn't affect variant identifier error message From c604bdbfe4e89fd5d786f267c6f9a463db589ba8 Mon Sep 17 00:00:00 2001 From: Baptiste de Montangon Date: Mon, 12 Jun 2023 17:17:15 +0200 Subject: [PATCH 3/3] Clarified tokens that represents tag and content for integer identifiers --- test_suite/tests/test_macros.rs | 54 ++++++++++++++++----------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/test_suite/tests/test_macros.rs b/test_suite/tests/test_macros.rs index ba089eaa5..62c1c5516 100644 --- a/test_suite/tests/test_macros.rs +++ b/test_suite/tests/test_macros.rs @@ -1094,7 +1094,7 @@ fn test_adjacently_tagged_enum() { name: "AdjacentlyTagged", len: 2, }, - Token::U64(0), + Token::U64(0), // tag field Token::Str("Unit"), Token::StructEnd, ], @@ -1138,9 +1138,9 @@ fn test_adjacently_tagged_enum() { name: "AdjacentlyTagged", len: 2, }, - Token::U64(0), + Token::U64(0), // tag field Token::Str("Unit"), - Token::U64(1), + Token::U64(1), // content field Token::Unit, Token::StructEnd, ], @@ -1186,9 +1186,9 @@ fn test_adjacently_tagged_enum() { name: "AdjacentlyTagged", len: 2, }, - Token::U64(1), + Token::U64(1), // content field Token::Unit, - Token::U64(0), + Token::U64(0), // tag field Token::Str("Unit"), Token::StructEnd, ], @@ -1242,13 +1242,13 @@ fn test_adjacently_tagged_enum() { }, Token::Str("f"), Token::Unit, - Token::U64(0), + Token::U64(0), // tag field Token::Str("Unit"), Token::Str("g"), Token::Unit, - Token::U64(1), + Token::U64(1), // content field Token::Unit, - Token::U64(3), + Token::U64(3), // unknown field Token::Unit, Token::StructEnd, ], @@ -1300,9 +1300,9 @@ fn test_adjacently_tagged_enum() { name: "AdjacentlyTagged", len: 2, }, - Token::U64(0), + Token::U64(0), // tag field Token::Str("Newtype"), - Token::U64(1), + Token::U64(1), // content field Token::U8(1), Token::StructEnd, ], @@ -1348,9 +1348,9 @@ fn test_adjacently_tagged_enum() { name: "AdjacentlyTagged", len: 2, }, - Token::U64(1), + Token::U64(1), // content field Token::U8(1), - Token::U64(0), + Token::U64(0), // tag field Token::Str("Newtype"), Token::StructEnd, ], @@ -1394,7 +1394,7 @@ fn test_adjacently_tagged_enum() { name: "AdjacentlyTagged", len: 1, }, - Token::U64(0), + Token::U64(0), // tag field Token::Str("Newtype"), Token::StructEnd, ], @@ -1441,9 +1441,9 @@ fn test_adjacently_tagged_enum() { name: "AdjacentlyTagged", len: 2, }, - Token::U64(0), + Token::U64(0), // tag field Token::Str("Tuple"), - Token::U64(1), + Token::U64(1), // content field Token::Tuple { len: 2 }, Token::U8(1), Token::U8(1), @@ -1498,12 +1498,12 @@ fn test_adjacently_tagged_enum() { name: "AdjacentlyTagged", len: 2, }, - Token::U64(1), + Token::U64(1), // content field Token::Tuple { len: 2 }, Token::U8(1), Token::U8(1), Token::TupleEnd, - Token::U64(0), + Token::U64(0), // tag field Token::Str("Tuple"), Token::StructEnd, ], @@ -1558,9 +1558,9 @@ fn test_adjacently_tagged_enum() { name: "AdjacentlyTagged", len: 2, }, - Token::U64(0), + Token::U64(0), // tag field Token::Str("Struct"), - Token::U64(1), + Token::U64(1), // content field Token::Struct { name: "Struct", len: 1, @@ -1624,7 +1624,7 @@ fn test_adjacently_tagged_enum() { name: "AdjacentlyTagged", len: 2, }, - Token::U64(1), + Token::U64(1), // content field Token::Struct { name: "Struct", len: 1, @@ -1632,7 +1632,7 @@ fn test_adjacently_tagged_enum() { Token::Str("f"), Token::U8(1), Token::StructEnd, - Token::U64(0), + Token::U64(0), // tag field Token::Str("Struct"), Token::StructEnd, ], @@ -1691,9 +1691,9 @@ fn test_adjacently_tagged_enum_deny_unknown_fields() { name: "AdjacentlyTagged", len: 2, }, - Token::U64(0), + Token::U64(0), // tag field Token::Str("Unit"), - Token::U64(1), + Token::U64(1), // content field Token::Unit, Token::StructEnd, ], @@ -1723,7 +1723,7 @@ fn test_adjacently_tagged_enum_deny_unknown_fields() { }, Token::Str("t"), Token::Str("Unit"), - Token::U64(1), + Token::U64(1), // content field Token::Unit, Token::StructEnd, ], @@ -1736,7 +1736,7 @@ fn test_adjacently_tagged_enum_deny_unknown_fields() { name: "AdjacentlyTagged", len: 2, }, - Token::U64(0), + Token::U64(0), // tag field Token::Str("Unit"), Token::Str("c"), Token::Unit, @@ -1753,7 +1753,7 @@ fn test_adjacently_tagged_enum_deny_unknown_fields() { }, Token::Bytes(b"t"), Token::Str("Unit"), - Token::U64(1), + Token::U64(1), // content field Token::Unit, Token::StructEnd, ], @@ -1860,7 +1860,7 @@ fn test_adjacently_tagged_enum_deny_unknown_fields() { name: "AdjacentlyTagged", len: 2, }, - Token::U64(0), + Token::U64(0), // tag field Token::Str("Unit"), Token::U64(3), ],