Catch an edge case
This commit is contained in:
parent
0094238157
commit
9455259450
@ -131,7 +131,11 @@ fn parse_token_tree_open_delim(
|
||||
diff_errs.push(diff_err);
|
||||
} else if parser.token.is_keyword(kw::If) {
|
||||
in_cond = true;
|
||||
} else if parser.token == token::CloseDelim(Delimiter::Brace) {
|
||||
} else if matches!(
|
||||
parser.token.kind,
|
||||
token::CloseDelim(Delimiter::Brace) | token::FatArrow
|
||||
) {
|
||||
// end of the `if`/`while` body, or the end of a `match` guard
|
||||
in_cond = false;
|
||||
} else if in_cond && parser.token == token::OpenDelim(Delimiter::Brace) {
|
||||
// Store the `&&` and `let` to use their spans later when creating the diagnostic
|
||||
|
@ -9,6 +9,15 @@ fn main() {
|
||||
}
|
||||
}
|
||||
|
||||
fn qux() {
|
||||
let foo = false;
|
||||
match foo {
|
||||
_ if foo => {
|
||||
&& let () = ()
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
|
||||
fn foo() {
|
||||
{
|
||||
&& let () = ()
|
||||
|
@ -1,9 +1,12 @@
|
||||
error: this file contains an unclosed delimiter
|
||||
--> $DIR/brace-in-let-chain.rs:28:54
|
||||
--> $DIR/brace-in-let-chain.rs:37:54
|
||||
|
|
||||
LL | fn main() {
|
||||
| - unclosed delimiter
|
||||
...
|
||||
LL | fn qux() {
|
||||
| - unclosed delimiter
|
||||
...
|
||||
LL | fn foo() {
|
||||
| - unclosed delimiter
|
||||
...
|
||||
|
Loading…
Reference in New Issue
Block a user