-
-
Notifications
You must be signed in to change notification settings - Fork 785
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Point out serde(untagged) variants which are out of order
Previously if someone wrote an enum containing: - `A` (untagged) - `B` (tagged) - `C` (tagged) - `D` (untagged) - `E` (tagged) - `F` (untagged) serde_derive would produce errors referring to B and E only, saying you're supposed to put untagged variants at the end. The choice of B and E for this error doesn't make a lot of sense because in order to resolve the issue, the user must either: - move A and D down or: - move B, C, and E up. This commit changes the error to appear on A and D instead.
- Loading branch information
Showing
2 changed files
with
16 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
test_suite/tests/ui/enum-representation/partially_tagged_wrong_order.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
error: all variants with the #[serde(untagged)] attribute must be placed at the end of the enum | ||
--> tests/ui/enum-representation/partially_tagged_wrong_order.rs:7:5 | ||
--> tests/ui/enum-representation/partially_tagged_wrong_order.rs:6:5 | ||
| | ||
7 | B(String), | ||
6 | A(u8), | ||
| ^ |