]> git.lizzy.rs Git - rust.git/blob - src/test/ui/type-check/assignment-in-if.stderr
Auto merge of #42709 - stepancheg:discriminant-hash, r=jseyfried
[rust.git] / src / test / ui / type-check / assignment-in-if.stderr
1 error[E0308]: mismatched types
2   --> $DIR/assignment-in-if.rs:25:8
3    |
4 25 |     if x = x {
5    |        ^^^^^
6    |        |
7    |        help: did you mean to compare equality? `x == x`
8    |        expected bool, found ()
9    |
10    = note: expected type `bool`
11               found type `()`
12
13 error[E0308]: mismatched types
14   --> $DIR/assignment-in-if.rs:31:8
15    |
16 31 |     if (x = x) {
17    |        ^^^^^^^
18    |        |
19    |        help: did you mean to compare equality? `x == x`
20    |        expected bool, found ()
21    |
22    = note: expected type `bool`
23               found type `()`
24
25 error[E0308]: mismatched types
26   --> $DIR/assignment-in-if.rs:37:8
27    |
28 37 |     if y = (Foo { foo: x }) {
29    |        ^^^^^^^^^^^^^^^^^^^^
30    |        |
31    |        help: did you mean to compare equality? `y == (Foo { foo: x })`
32    |        expected bool, found ()
33    |
34    = note: expected type `bool`
35               found type `()`
36
37 error[E0308]: mismatched types
38   --> $DIR/assignment-in-if.rs:43:8
39    |
40 43 |     if 3 = x {
41    |        ^^^^^
42    |        |
43    |        help: did you mean to compare equality? `3 == x`
44    |        expected bool, found ()
45    |
46    = note: expected type `bool`
47               found type `()`
48
49 error[E0308]: mismatched types
50   --> $DIR/assignment-in-if.rs:48:8
51    |
52 48 |     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 previous error(s)
59