File tree Expand file tree Collapse file tree 3 files changed +18
-2
lines changed
compiler/rustc_parse/src/lexer Expand file tree Collapse file tree 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> {
131131 diff_errs. push ( diff_err) ;
132132 } else if parser. token . is_keyword ( kw:: If ) {
133133 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
135139 in_cond = false ;
136140 } else if in_cond && parser. token == token:: OpenDelim ( Delimiter :: Brace ) {
137141 // 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() {
99 }
1010}
1111
12+ fn qux ( ) {
13+ let foo = false ;
14+ match foo {
15+ _ if foo => {
16+ & & let ( ) = ( )
17+ _ => { }
18+ }
19+ }
20+
1221fn foo( ) {
1322 {
1423 & & let ( ) = ( )
Original file line number Diff line number Diff line change 11error: this file contains an unclosed delimiter
2- --> $DIR/brace-in-let-chain.rs:28 :54
2+ --> $DIR/brace-in-let-chain.rs:37 :54
33 |
44LL | fn main() {
55 | - unclosed delimiter
66...
7+ LL | fn qux() {
8+ | - unclosed delimiter
9+ ...
710LL | fn foo() {
811 | - unclosed delimiter
912...
You can’t perform that action at this time.
0 commit comments