]> git.lizzy.rs Git - rust.git/blob - src/test/ui/type/type-check/assignment-in-if.stderr
Auto merge of #57119 - jethrogb:jb/sgx-os-mod2, r=joshtriplett
[rust.git] / src / test / ui / type / type-check / assignment-in-if.stderr
1 error[E0308]: mismatched types
2   --> $DIR/assignment-in-if.rs:15:8
3    |
4 LL |     if x = x {
5    |        ^^^^^
6    |        |
7    |        expected bool, found ()
8    |        help: try comparing for equality: `x == x`
9    |
10    = note: expected type `bool`
11               found type `()`
12
13 error[E0308]: mismatched types
14   --> $DIR/assignment-in-if.rs:20:8
15    |
16 LL |     if (x = x) {
17    |        ^^^^^^^
18    |        |
19    |        expected bool, found ()
20    |        help: try comparing for equality: `x == x`
21    |
22    = note: expected type `bool`
23               found type `()`
24
25 error[E0308]: mismatched types
26   --> $DIR/assignment-in-if.rs:25:8
27    |
28 LL |     if y = (Foo { foo: x }) {
29    |        ^^^^^^^^^^^^^^^^^^^^
30    |        |
31    |        expected bool, found ()
32    |        help: try comparing for equality: `y == (Foo { foo: x })`
33    |
34    = note: expected type `bool`
35               found type `()`
36
37 error[E0308]: mismatched types
38   --> $DIR/assignment-in-if.rs:30:8
39    |
40 LL |     if 3 = x {
41    |        ^^^^^
42    |        |
43    |        expected bool, found ()
44    |        help: try comparing for equality: `3 == x`
45    |
46    = note: expected type `bool`
47               found type `()`
48
49 error[E0308]: mismatched types
50   --> $DIR/assignment-in-if.rs:34:8
51    |
52 LL |     if (if true { x = 4 } else { x = 5 }) {
53    |        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected bool, found ()
54    |
55    = note: expected type `bool`
56               found type `()`
57
58 error: aborting due to 5 previous errors
59
60 For more information about this error, try `rustc --explain E0308`.