File tree Expand file tree Collapse file tree 2 files changed +23
-2
lines changed
src/test/ui/type/type-check Expand file tree Collapse file tree 2 files changed +23
-2
lines changed Original file line number Diff line number Diff line change @@ -26,4 +26,9 @@ fn main() {
2626 let _ = ( 0 = 0 ) //~ ERROR mismatched types [E0308]
2727 && { 0 = 0 } //~ ERROR mismatched types [E0308]
2828 || ( 0 = 0 ) ; //~ ERROR mismatched types [E0308]
29+
30+ // A test to check that not expecting `bool` behaves well:
31+ let _: usize = 0 = 0 ;
32+ //~^ ERROR mismatched types [E0308]
33+ //~| ERROR invalid left-hand side expression [E0070]
2934}
Original file line number Diff line number Diff line change @@ -130,6 +130,22 @@ LL | || (0 = 0);
130130 = note: expected type `bool`
131131 found type `()`
132132
133- error: aborting due to 11 previous errors
133+ error[E0070]: invalid left-hand side expression
134+ --> $DIR/assignment-expected-bool.rs:31:20
135+ |
136+ LL | let _: usize = 0 = 0;
137+ | ^^^^^ left-hand of expression not valid
138+
139+ error[E0308]: mismatched types
140+ --> $DIR/assignment-expected-bool.rs:31:20
141+ |
142+ LL | let _: usize = 0 = 0;
143+ | ^^^^^ expected usize, found ()
144+ |
145+ = note: expected type `usize`
146+ found type `()`
147+
148+ error: aborting due to 13 previous errors
134149
135- For more information about this error, try `rustc --explain E0308`.
150+ Some errors occurred: E0070, E0308.
151+ For more information about an error, try `rustc --explain E0070`.
You can’t perform that action at this time.
0 commit comments