]> git.lizzy.rs Git - rust.git/blob - src/test/ui/match/match-type-err-first-arm.stderr
Auto merge of #106349 - LeSeulArtichaut:dyn-star-tracking-issue, r=jackh726
[rust.git] / src / test / ui / match / match-type-err-first-arm.stderr
1 error[E0308]: mismatched types
2   --> $DIR/match-type-err-first-arm.rs:8:15
3    |
4 LL | fn test_func1(n: i32) -> i32 {
5    |                          --- expected `i32` because of return type
6 LL |     match n {
7 LL |         12 => 'b',
8    |               ^^^ expected `i32`, found `char`
9    |
10 help: you can cast a `char` to an `i32`, since a `char` always occupies 4 bytes
11    |
12 LL |         12 => 'b' as i32,
13    |                   ++++++
14
15 error[E0308]: `match` arms have incompatible types
16   --> $DIR/match-type-err-first-arm.rs:18:14
17    |
18 LL |       let x = match n {
19    |  _____________-
20 LL | |         12 => 'b',
21    | |               --- this is found to be of type `char`
22 LL | |         _ => 42,
23    | |              ^^ expected `char`, found integer
24 LL | |
25 LL | |
26 LL | |     };
27    | |_____- `match` arms have incompatible types
28
29 error[E0308]: `match` arms have incompatible types
30   --> $DIR/match-type-err-first-arm.rs:34:14
31    |
32 LL |       let x = match n {
33    |  _____________-
34 LL | |         1 => 'b',
35 LL | |         2 => 'b',
36 LL | |         3 => 'b',
37 ...  |
38 LL | |         6 => 'b',
39    | |              --- this and all prior arms are found to be of type `char`
40 LL | |
41 LL | |         _ => 42,
42    | |              ^^ expected `char`, found integer
43 LL | |
44 LL | |
45 LL | |     };
46    | |_____- `match` arms have incompatible types
47
48 error[E0308]: `match` arms have incompatible types
49   --> $DIR/match-type-err-first-arm.rs:46:17
50    |
51 LL | /     match Some(0u32) {
52 LL | |         Some(x) => {
53 LL | |             x
54    | |             - this is found to be of type `u32`
55 LL | |         },
56 LL | |         None => {}
57    | |                 ^^ expected `u32`, found `()`
58 LL | |
59 LL | |
60 LL | |     };
61    | |_____- `match` arms have incompatible types
62
63 error: aborting due to 4 previous errors
64
65 For more information about this error, try `rustc --explain E0308`.