Auto merge of #12398 - WeiTheShinobi:bug-lint-numbered_fields, r=Manishearth

bug fix: lint numbered_fields message error

fixes #12367

changelog: [`numbered_fields`]: fix macro expand message error.
This commit is contained in:
bors 2024-05-22 15:50:46 +00:00
commit 05c4053628
4 changed files with 19 additions and 3 deletions

View file

@ -34,4 +34,9 @@ fn main() {
// Aliases can't be tuple constructed #8638
let _ = Alias { 0: 0, 1: 1, 2: 2 };
// Issue #12367
struct TupleStructVec(Vec<usize>);
let _ = TupleStructVec(vec![0, 1, 2, 3]);
}

View file

@ -42,4 +42,9 @@ fn main() {
// Aliases can't be tuple constructed #8638
let _ = Alias { 0: 0, 1: 1, 2: 2 };
// Issue #12367
struct TupleStructVec(Vec<usize>);
let _ = TupleStructVec { 0: vec![0, 1, 2, 3] };
}

View file

@ -23,5 +23,11 @@ LL | | 1: 3u32,
LL | | };
| |_____^ help: try: `TupleStruct(1u32, 3u32, 2u8)`
error: aborting due to 2 previous errors
error: used a field initializer for a tuple struct
--> tests/ui/numbered_fields.rs:49:13
|
LL | let _ = TupleStructVec { 0: vec![0, 1, 2, 3] };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `TupleStructVec(vec![0, 1, 2, 3])`
error: aborting due to 3 previous errors