File tree 1 file changed +3
-7
lines changed
compiler/rustc_parse/src/parser
1 file changed +3
-7
lines changed Original file line number Diff line number Diff line change @@ -58,21 +58,17 @@ impl<'a> Parser<'a> {
58
58
let attrs = self . parse_inner_attributes ( ) ?;
59
59
60
60
let post_attr_lo = self . token . span ;
61
- let mut items = ThinVec :: new ( ) ;
61
+ let mut items: ThinVec < P < _ > > = ThinVec :: new ( ) ;
62
62
63
- // There shouldn't be any semicolons before or afer items.
63
+ // There shouldn't be any stray semicolons before or after items.
64
64
// `parse_item` consumes the appropriate semicolons so any leftover is an error.
65
- let mut last = None ;
66
65
loop {
67
- while self . maybe_consume_incorrect_semicolon ( last) { } // Eat all bad semicolons
66
+ while self . maybe_consume_incorrect_semicolon ( items . last ( ) . map ( |x| & * * x ) ) { } // Eat all bad semicolons
68
67
let Some ( item) = self . parse_item ( ForceCollect :: No ) ? else {
69
68
break ;
70
69
} ;
71
70
items. push ( item) ;
72
- last = items. last ( ) . map ( |x| & * * x) ;
73
71
}
74
- // Handle trailing semicolon at the end of the module
75
- self . maybe_consume_incorrect_semicolon ( last) ;
76
72
77
73
if !self . eat ( term) {
78
74
let token_str = super :: token_descr ( & self . token ) ;
You can’t perform that action at this time.
0 commit comments