Skip to content

Commit 1036fa7

Browse files
committed
Don't match invisible delimiters in can_begin_expr.
This has no effect right now because invisible delimiters aren't produced by `TokenCursor`, but it will have an effect if/when that changes.
1 parent 5013b61 commit 1036fa7

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

compiler/rustc_ast/src/token.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -421,10 +421,11 @@ impl Token {
421421

422422
/// Returns `true` if the token can appear at the start of an expression.
423423
pub fn can_begin_expr(&self) -> bool {
424+
use Delimiter::*;
424425
match self.uninterpolate().kind {
425426
Ident(name, is_raw) =>
426427
ident_can_begin_expr(name, self.span, is_raw), // value name or keyword
427-
OpenDelim(..) | // tuple, array or block
428+
OpenDelim(Parenthesis | Brace | Bracket) | // tuple, array or block
428429
Literal(..) | // literal
429430
Not | // operator not
430431
BinOp(Minus) | // unary minus

0 commit comments

Comments
 (0)