forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#117743 - sjwang05:issue-117720, r=estebank Suggest removing `;` for `;` within let-chains Fixes rust-lang#117720
- Loading branch information
Showing
3 changed files
with
97 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// Issue #117720 | ||
|
||
#![feature(let_chains)] | ||
|
||
fn main() { | ||
if let () = () | ||
&& let () = (); //~ERROR | ||
&& let () = () | ||
{ | ||
} | ||
} | ||
|
||
fn foo() { | ||
if let () = () | ||
&& () == (); //~ERROR | ||
&& 1 < 0 | ||
{ | ||
} | ||
} | ||
|
||
fn bar() { | ||
if let () = () | ||
&& () == (); //~ERROR | ||
&& let () = () | ||
{ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
error: expected `{`, found `;` | ||
--> $DIR/semi-in-let-chain.rs:7:23 | ||
| | ||
LL | && let () = (); | ||
| ^ expected `{` | ||
| | ||
note: you likely meant to continue parsing the let-chain starting here | ||
--> $DIR/semi-in-let-chain.rs:8:9 | ||
| | ||
LL | && let () = () | ||
| ^^^^^^ | ||
help: consider removing this semicolon to parse the `let` as part of the same chain | ||
| | ||
LL - && let () = (); | ||
LL + && let () = () | ||
| | ||
|
||
error: expected `{`, found `;` | ||
--> $DIR/semi-in-let-chain.rs:15:20 | ||
| | ||
LL | && () == (); | ||
| ^ expected `{` | ||
| | ||
note: the `if` expression is missing a block after this condition | ||
--> $DIR/semi-in-let-chain.rs:14:8 | ||
| | ||
LL | if let () = () | ||
| ________^ | ||
LL | | && () == (); | ||
| |___________________^ | ||
|
||
error: expected `{`, found `;` | ||
--> $DIR/semi-in-let-chain.rs:23:20 | ||
| | ||
LL | && () == (); | ||
| ^ expected `{` | ||
| | ||
note: you likely meant to continue parsing the let-chain starting here | ||
--> $DIR/semi-in-let-chain.rs:24:9 | ||
| | ||
LL | && let () = () | ||
| ^^^^^^ | ||
help: consider removing this semicolon to parse the `let` as part of the same chain | ||
| | ||
LL - && () == (); | ||
LL + && () == () | ||
| | ||
|
||
error: aborting due to 3 previous errors | ||
|