File tree 2 files changed +23
-2
lines changed
src/test/ui/type/type-check
2 files changed +23
-2
lines changed Original file line number Diff line number Diff line change @@ -26,4 +26,9 @@ fn main() {
26
26
let _ = ( 0 = 0 ) //~ ERROR mismatched types [E0308]
27
27
&& { 0 = 0 } //~ ERROR mismatched types [E0308]
28
28
|| ( 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]
29
34
}
Original file line number Diff line number Diff line change @@ -130,6 +130,22 @@ LL | || (0 = 0);
130
130
= note: expected type `bool`
131
131
found type `()`
132
132
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
134
149
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