-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve diagnostic for missing half of binary operator in
if
condition
- Loading branch information
1 parent
6db0a0e
commit ba7374e
Showing
4 changed files
with
77 additions
and
11 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
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,10 @@ | ||
// Regression test for issue #91421. | ||
|
||
fn main() { | ||
let value = if true && { | ||
//~^ ERROR: this `if` expression has a condition, but no block | ||
//~| HELP: maybe you forgot the right operand of the condition? | ||
3 | ||
//~^ ERROR: mismatched types [E0308] | ||
} else { 4 }; | ||
} |
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,21 @@ | ||
error: this `if` expression has a condition, but no block | ||
--> $DIR/issue-91421.rs:4:17 | ||
| | ||
LL | let value = if true && { | ||
| ^^ | ||
| | ||
help: maybe you forgot the right operand of the condition? | ||
--> $DIR/issue-91421.rs:4:25 | ||
| | ||
LL | let value = if true && { | ||
| ^^ | ||
|
||
error[E0308]: mismatched types | ||
--> $DIR/issue-91421.rs:7:9 | ||
| | ||
LL | 3 | ||
| ^ expected `bool`, found integer | ||
|
||
error: aborting due to 2 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0308`. |