File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed
src/libsyntax/parse/parser Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -178,8 +178,13 @@ impl<'a> Parser<'a> {
178
178
/// Recursive possibly-or-pattern parser with recovery for an erroneous leading `|`.
179
179
/// See `parse_pat_with_or` for details on parsing or-patterns.
180
180
fn parse_pat_with_or_inner ( & mut self , expected : Expected ) -> PResult < ' a , P < Pat > > {
181
- // Recover if `|` or `||` is here.
182
- // The user is thinking that a leading `|` is allowed in this position.
181
+ self . recover_inner_leading_vert ( ) ;
182
+ self . parse_pat_with_or ( expected, GateOr :: Yes , TopLevel :: No )
183
+ }
184
+
185
+ /// Recover if `|` or `||` is here.
186
+ /// The user is thinking that a leading `|` is allowed in this position.
187
+ fn recover_inner_leading_vert ( & mut self ) {
183
188
if let token:: BinOp ( token:: Or ) | token:: OrOr = self . token . kind {
184
189
let span = self . token . span ;
185
190
let rm_msg = format ! ( "remove the `{}`" , pprust:: token_to_string( & self . token) ) ;
@@ -190,8 +195,6 @@ impl<'a> Parser<'a> {
190
195
191
196
self . bump ( ) ;
192
197
}
193
-
194
- self . parse_pat_with_or ( expected, GateOr :: Yes , TopLevel :: No )
195
198
}
196
199
197
200
/// Parses a pattern, with a setting whether modern range patterns (e.g., `a..=b`, `a..b` are
You can’t perform that action at this time.
0 commit comments