File tree Expand file tree Collapse file tree 3 files changed +21
-2
lines changed Expand file tree Collapse file tree 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> {
24912491 }
24922492
24932493 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) ;
24952496 self . bump ( ) ;
24962497 Ok ( Ident :: new ( name, self . prev_span ) )
24972498 } else {
Original file line number Diff line number Diff line change @@ -9,4 +9,10 @@ fn main() {
99 let d = c. 1 suffix ;
1010 //~^ ERROR suffixes on a tuple index are invalid
1111 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+ }
1218}
Original file line number Diff line number Diff line change @@ -10,5 +10,17 @@ error: suffixes on a tuple index are invalid
1010LL | let d = c.1suffix;
1111 | ^^^^^^^ invalid suffix `suffix`
1212
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
1426
You can’t perform that action at this time.
0 commit comments