Skip to content

Commit dcdbb88

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 make more sense once invisible delimiter origins are introduced.
1 parent 50d454d commit dcdbb88

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
@@ -498,10 +498,11 @@ impl Token {
498498

499499
/// Returns `true` if the token can appear at the start of an expression.
500500
pub fn can_begin_expr(&self) -> bool {
501+
use Delimiter::*;
501502
match self.uninterpolate().kind {
502503
Ident(name, is_raw) =>
503504
ident_can_begin_expr(name, self.span, is_raw), // value name or keyword
504-
OpenDelim(..) | // tuple, array or block
505+
OpenDelim(Parenthesis | Brace | Bracket) | // tuple, array or block
505506
Literal(..) | // literal
506507
Not | // operator not
507508
BinOp(Minus) | // unary minus

0 commit comments

Comments
 (0)