suggest == to the first expr which has ExprKind::Assign
This commit is contained in:
parent
0ca356586f
commit
57d0278d5c
3 changed files with 36 additions and 1 deletions
|
|
@ -53,4 +53,10 @@ fn main() {
|
|||
//~| ERROR mismatched types
|
||||
println!("{}", x);
|
||||
}
|
||||
|
||||
if x = 1 && x == 1 {
|
||||
//~^ ERROR mismatched types
|
||||
//~| ERROR mismatched types
|
||||
println!("{}", x);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -104,6 +104,23 @@ help: you might have meant to compare for equality
|
|||
LL | if x == x && x == x && x == x {
|
||||
| +
|
||||
|
||||
error: aborting due to 11 previous errors
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/assignment-in-if.rs:57:12
|
||||
|
|
||||
LL | if x = 1 && x == 1 {
|
||||
| ^ expected `bool`, found integer
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/assignment-in-if.rs:57:8
|
||||
|
|
||||
LL | if x = 1 && x == 1 {
|
||||
| ^^^^^^^^^^^^^^^ expected `bool`, found `()`
|
||||
|
|
||||
help: you might have meant to compare for equality
|
||||
|
|
||||
LL | if x == 1 && x == 1 {
|
||||
| +
|
||||
|
||||
error: aborting due to 13 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0308`.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue