adjust assignment-in-if test accordingly.
This commit is contained in:
parent
05d59feb64
commit
0b9c589beb
@ -31,8 +31,13 @@ fn main() {
|
||||
//~^ ERROR mismatched types
|
||||
println!("{}", x);
|
||||
}
|
||||
if (if true { x = 4 } else { x = 5 }) {
|
||||
//~^ ERROR mismatched types
|
||||
if (
|
||||
if true {
|
||||
x = 4 //~ ERROR mismatched types
|
||||
} else {
|
||||
x = 5 //~ ERROR mismatched types
|
||||
}
|
||||
) {
|
||||
println!("{}", x);
|
||||
}
|
||||
}
|
||||
|
@ -47,14 +47,29 @@ LL | if 3 = x {
|
||||
found type `()`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/assignment-in-if.rs:34:8
|
||||
--> $DIR/assignment-in-if.rs:36:13
|
||||
|
|
||||
LL | if (if true { x = 4 } else { x = 5 }) {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected bool, found ()
|
||||
LL | x = 4
|
||||
| ^^^^^
|
||||
| |
|
||||
| expected bool, found ()
|
||||
| help: try comparing for equality: `x == 4`
|
||||
|
|
||||
= note: expected type `bool`
|
||||
found type `()`
|
||||
|
||||
error: aborting due to 5 previous errors
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/assignment-in-if.rs:38:13
|
||||
|
|
||||
LL | x = 5
|
||||
| ^^^^^
|
||||
| |
|
||||
| expected bool, found ()
|
||||
| help: try comparing for equality: `x == 5`
|
||||
|
|
||||
= note: expected type `bool`
|
||||
found type `()`
|
||||
|
||||
error: aborting due to 6 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0308`.
|
||||
|
Loading…
Reference in New Issue
Block a user