]> git.lizzy.rs Git - rust.git/blob - src/test/ui/if-else-type-mismatch.stderr
Tweak output of type mismatch between "then" and `else` `if` arms
[rust.git] / src / test / ui / if-else-type-mismatch.stderr
1 error[E0308]: if and else have incompatible types
2   --> $DIR/if-else-type-mismatch.rs:5:9
3    |
4 LL |       let _ = if true {
5    |  _____________-
6 LL | |         42i32
7    | |         ----- expected because of this
8 LL | |     } else {
9 LL | |         42u32
10    | |         ^^^^^ expected i32, found u32
11 LL | |     };
12    | |_____- if and else have incompatible types
13    |
14    = note: expected type `i32`
15               found type `u32`
16
17 error[E0308]: if and else have incompatible types
18   --> $DIR/if-else-type-mismatch.rs:8:38
19    |
20 LL |     let _ = if true { 42i32 } else { 42u32 };
21    |                       -----          ^^^^^ expected i32, found u32
22    |                       |
23    |                       expected because of this
24    |
25    = note: expected type `i32`
26               found type `u32`
27
28 error[E0308]: if and else have incompatible types
29   --> $DIR/if-else-type-mismatch.rs:13:9
30    |
31 LL |       let _ = if true {
32    |  _____________-
33 LL | |         42i32;
34    | |         ------ expected because of this
35 LL | |     } else {
36 LL | |         42u32
37    | |         ^^^^^ expected (), found u32
38 LL | |     };
39    | |_____- if and else have incompatible types
40    |
41    = note: expected type `()`
42               found type `u32`
43
44 error[E0308]: if and else have incompatible types
45   --> $DIR/if-else-type-mismatch.rs:19:9
46    |
47 LL |       let _ = if true {
48    |  _____________-
49 LL | |         42i32
50    | |         ----- expected because of this
51 LL | |     } else {
52 LL | |         42u32;
53    | |         ^^^^^^ expected i32, found ()
54 LL | |     };
55    | |_____- if and else have incompatible types
56    |
57    = note: expected type `i32`
58               found type `()`
59
60 error[E0308]: if and else have incompatible types
61   --> $DIR/if-else-type-mismatch.rs:25:9
62    |
63 LL |       let _ = if true {
64    |  _____________________-
65 LL | |
66 LL | |     } else {
67    | |_____- expected because of this
68 LL |           42u32
69    |           ^^^^^ expected (), found u32
70    |
71    = note: expected type `()`
72               found type `u32`
73
74 error[E0308]: if and else have incompatible types
75   --> $DIR/if-else-type-mismatch.rs:30:12
76    |
77 LL |       let _ = if true {
78    |               ------- if and else have incompatible types
79 LL |           42i32
80    |           ----- expected because of this
81 LL |       } else {
82    |  ____________^
83 LL | |
84 LL | |     };
85    | |_____^ expected i32, found ()
86    |
87    = note: expected type `i32`
88               found type `()`
89
90 error: aborting due to 6 previous errors
91
92 For more information about this error, try `rustc --explain E0308`.