File tree 3 files changed +21
-2
lines changed
3 files changed +21
-2
lines changed Original file line number Diff line number Diff line change @@ -2491,7 +2491,8 @@ impl<'a> Parser<'a> {
2491
2491
}
2492
2492
2493
2493
fn parse_field_name ( & mut self ) -> PResult < ' a , Ident > {
2494
- if let token:: Literal ( token:: Integer ( name) , None ) = self . token {
2494
+ if let token:: Literal ( token:: Integer ( name) , suffix) = self . token {
2495
+ self . expect_no_suffix ( self . span , "a tuple index" , suffix) ;
2495
2496
self . bump ( ) ;
2496
2497
Ok ( Ident :: new ( name, self . prev_span ) )
2497
2498
} else {
Original file line number Diff line number Diff line change @@ -9,4 +9,10 @@ fn main() {
9
9
let d = c. 1 suffix ;
10
10
//~^ ERROR suffixes on a tuple index are invalid
11
11
println ! ( "{}" , d) ;
12
+ let s = X { 0 suffix : 0 , 1 : 1 , 2 : 2 } ;
13
+ //~^ ERROR suffixes on a tuple index are invalid
14
+ match s {
15
+ X { 0 suffix : _, .. } => { }
16
+ //~^ ERROR suffixes on a tuple index are invalid
17
+ }
12
18
}
Original file line number Diff line number Diff line change @@ -10,5 +10,17 @@ error: suffixes on a tuple index are invalid
10
10
LL | let d = c.1suffix;
11
11
| ^^^^^^^ invalid suffix `suffix`
12
12
13
- error: aborting due to 2 previous errors
13
+ error: suffixes on a tuple index are invalid
14
+ --> $DIR/issue-59418.rs:12:17
15
+ |
16
+ LL | let s = X { 0suffix: 0, 1: 1, 2: 2 };
17
+ | ^^^^^^^ invalid suffix `suffix`
18
+
19
+ error: suffixes on a tuple index are invalid
20
+ --> $DIR/issue-59418.rs:15:13
21
+ |
22
+ LL | X { 0suffix: _, .. } => {}
23
+ | ^^^^^^^ invalid suffix `suffix`
24
+
25
+ error: aborting due to 4 previous errors
14
26
You can’t perform that action at this time.
0 commit comments