add negative test case in assignment-expected-bool
This commit is contained in:
parent
0b9c589beb
commit
ce1c5e0a61
@ -26,4 +26,9 @@ fn main() {
|
||||
let _ = (0 = 0) //~ ERROR mismatched types [E0308]
|
||||
&& { 0 = 0 } //~ ERROR mismatched types [E0308]
|
||||
|| (0 = 0); //~ ERROR mismatched types [E0308]
|
||||
|
||||
// A test to check that not expecting `bool` behaves well:
|
||||
let _: usize = 0 = 0;
|
||||
//~^ ERROR mismatched types [E0308]
|
||||
//~| ERROR invalid left-hand side expression [E0070]
|
||||
}
|
||||
|
@ -130,6 +130,22 @@ LL | || (0 = 0);
|
||||
= note: expected type `bool`
|
||||
found type `()`
|
||||
|
||||
error: aborting due to 11 previous errors
|
||||
error[E0070]: invalid left-hand side expression
|
||||
--> $DIR/assignment-expected-bool.rs:31:20
|
||||
|
|
||||
LL | let _: usize = 0 = 0;
|
||||
| ^^^^^ left-hand of expression not valid
|
||||
|
||||
For more information about this error, try `rustc --explain E0308`.
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/assignment-expected-bool.rs:31:20
|
||||
|
|
||||
LL | let _: usize = 0 = 0;
|
||||
| ^^^^^ expected usize, found ()
|
||||
|
|
||||
= note: expected type `usize`
|
||||
found type `()`
|
||||
|
||||
error: aborting due to 13 previous errors
|
||||
|
||||
Some errors occurred: E0070, E0308.
|
||||
For more information about an error, try `rustc --explain E0070`.
|
||||
|
Loading…
Reference in New Issue
Block a user