File tree 3 files changed +18
-2
lines changed
compiler/rustc_parse/src/lexer
3 files changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -131,7 +131,11 @@ impl<'a> TokenTreesReader<'a> {
131
131
diff_errs. push ( diff_err) ;
132
132
} else if parser. token . is_keyword ( kw:: If ) {
133
133
in_cond = true ;
134
- } else if parser. token == token:: CloseDelim ( Delimiter :: Brace ) {
134
+ } else if matches ! (
135
+ parser. token. kind,
136
+ token:: CloseDelim ( Delimiter :: Brace ) | token:: FatArrow
137
+ ) {
138
+ // end of the `if`/`while` body, or the end of a `match` guard
135
139
in_cond = false ;
136
140
} else if in_cond && parser. token == token:: OpenDelim ( Delimiter :: Brace ) {
137
141
// Store the `&&` and `let` to use their spans later when creating the diagnostic
Original file line number Diff line number Diff line change @@ -9,6 +9,15 @@ fn main() {
9
9
}
10
10
}
11
11
12
+ fn qux ( ) {
13
+ let foo = false ;
14
+ match foo {
15
+ _ if foo => {
16
+ & & let ( ) = ( )
17
+ _ => { }
18
+ }
19
+ }
20
+
12
21
fn foo( ) {
13
22
{
14
23
& & let ( ) = ( )
Original file line number Diff line number Diff line change 1
1
error: this file contains an unclosed delimiter
2
- --> $DIR/brace-in-let-chain.rs:28 :54
2
+ --> $DIR/brace-in-let-chain.rs:37 :54
3
3
|
4
4
LL | fn main() {
5
5
| - unclosed delimiter
6
6
...
7
+ LL | fn qux() {
8
+ | - unclosed delimiter
9
+ ...
7
10
LL | fn foo() {
8
11
| - unclosed delimiter
9
12
...
You can’t perform that action at this time.
0 commit comments