Skip to content

Commit 69b5f2d

Browse files
committed
Only accept ... in range patterns.
Closes rust-lang#17295 [breaking-change] We previously accepted `..` and then `..` or `...`. To fix change `..` to `...` in range patterns.
1 parent 3be6a2f commit 69b5f2d

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

src/libsyntax/parse/parser.rs

+3-8
Original file line numberDiff line numberDiff line change
@@ -3237,8 +3237,7 @@ impl<'a> Parser<'a> {
32373237
// These expressions are limited to literals (possibly
32383238
// preceded by unary-minus) or identifiers.
32393239
let val = self.parse_literal_maybe_minus();
3240-
// FIXME(#17295) remove the DOTDOT option.
3241-
if (self.token == token::DOTDOTDOT || self.token == token::DOTDOT) &&
3240+
if self.token == token::DOTDOTDOT &&
32423241
self.look_ahead(1, |t| {
32433242
*t != token::COMMA && *t != token::RBRACKET
32443243
}) {
@@ -3283,16 +3282,12 @@ impl<'a> Parser<'a> {
32833282
}
32843283
});
32853284

3286-
// FIXME(#17295) remove the DOTDOT option.
3287-
if self.look_ahead(1, |t| *t == token::DOTDOTDOT || *t == token::DOTDOT) &&
3285+
if self.look_ahead(1, |t| *t == token::DOTDOTDOT) &&
32883286
self.look_ahead(2, |t| {
32893287
*t != token::COMMA && *t != token::RBRACKET
32903288
}) {
32913289
let start = self.parse_expr_res(RestrictionNoBarOp);
3292-
// FIXME(#17295) remove the DOTDOT option (self.eat(&token::DOTDOTDOT)).
3293-
if self.token == token::DOTDOTDOT || self.token == token::DOTDOT {
3294-
self.bump();
3295-
}
3290+
self.eat(&token::DOTDOTDOT);
32963291
let end = self.parse_expr_res(RestrictionNoBarOp);
32973292
pat = PatRange(start, end);
32983293
} else if is_plain_ident(&self.token) && !can_be_enum_or_struct {

0 commit comments

Comments
 (0)