]> git.lizzy.rs Git - rust.git/blob - src/test/ui/if-else-type-mismatch.stderr
d25eda0e9805734ec3898090c5f4bb647f80ebcc
[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 | |         1i32
7    | |         ---- expected because of this
8 LL | |     } else {
9 LL | |         2u32
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 | |         3u32;
34    | |         -----
35    | |         |   |
36    | |         |   help: consider removing this semicolon
37    | |         expected because of this
38 LL | |     } else {
39 LL | |         4u32
40    | |         ^^^^ expected (), found u32
41 LL | |     };
42    | |_____- if and else have incompatible types
43    |
44    = note: expected type `()`
45               found type `u32`
46
47 error[E0308]: if and else have incompatible types
48   --> $DIR/if-else-type-mismatch.rs:19:9
49    |
50 LL |       let _ = if true {
51    |  _____________-
52 LL | |         5u32
53    | |         ---- expected because of this
54 LL | |     } else {
55 LL | |         6u32;
56    | |         ^^^^-
57    | |         |   |
58    | |         |   help: consider removing this semicolon
59    | |         expected u32, found ()
60 LL | |     };
61    | |_____- if and else have incompatible types
62    |
63    = note:   expected type `u32`
64            found unit type `()`
65
66 error[E0308]: if and else have incompatible types
67   --> $DIR/if-else-type-mismatch.rs:25:9
68    |
69 LL |       let _ = if true {
70    |  _____________-
71 LL | |         7i32;
72    | |         ----- expected because of this
73 LL | |     } else {
74 LL | |         8u32
75    | |         ^^^^ expected (), found u32
76 LL | |     };
77    | |_____- if and else have incompatible types
78    |
79    = note: expected type `()`
80               found type `u32`
81
82 error[E0308]: if and else have incompatible types
83   --> $DIR/if-else-type-mismatch.rs:31:9
84    |
85 LL |       let _ = if true {
86    |  _____________-
87 LL | |         9i32
88    | |         ---- expected because of this
89 LL | |     } else {
90 LL | |         10u32;
91    | |         ^^^^^^ expected i32, found ()
92 LL | |     };
93    | |_____- if and else have incompatible types
94    |
95    = note:   expected type `i32`
96            found unit type `()`
97
98 error[E0308]: if and else have incompatible types
99   --> $DIR/if-else-type-mismatch.rs:37:9
100    |
101 LL |       let _ = if true {
102    |  _____________________-
103 LL | |
104 LL | |     } else {
105    | |_____- expected because of this
106 LL |           11u32
107    |           ^^^^^ expected (), found u32
108    |
109    = note: expected type `()`
110               found type `u32`
111
112 error[E0308]: if and else have incompatible types
113   --> $DIR/if-else-type-mismatch.rs:42:12
114    |
115 LL |       let _ = if true {
116    |               ------- if and else have incompatible types
117 LL |           12i32
118    |           ----- expected because of this
119 LL |       } else {
120    |  ____________^
121 LL | |
122 LL | |     };
123    | |_____^ expected i32, found ()
124    |
125    = note:   expected type `i32`
126            found unit type `()`
127
128 error: aborting due to 8 previous errors
129
130 For more information about this error, try `rustc --explain E0308`.