]>
Commit | Line | Data |
---|---|---|
dfeec247 | 1 | error[E0308]: `match` arms have incompatible types |
e74abb32 XL |
2 | --> $DIR/wf-unsafe-trait-obj-match.rs:23:17 |
3 | | | |
4 | LL | / match opt() { | |
5 | LL | | Some(()) => &S, | |
6 | | | -- this is found to be of type `&S` | |
7 | LL | | None => &R, | |
8 | | | ^^ expected struct `S`, found struct `R` | |
9 | LL | | } | |
10 | | |_____- `match` arms have incompatible types | |
11 | | | |
60c5eb7d XL |
12 | = note: expected type `&S` |
13 | found reference `&R` | |
e74abb32 XL |
14 | |
15 | error[E0038]: the trait `Trait` cannot be made into an object | |
16 | --> $DIR/wf-unsafe-trait-obj-match.rs:26:21 | |
17 | | | |
74b04a01 XL |
18 | LL | trait Trait: Sized {} |
19 | | ----- ----- ...because it requires `Self: Sized` | |
20 | | | | |
21 | | this trait cannot be made into an object... | |
22 | ... | |
e74abb32 XL |
23 | LL | Some(()) => &S, |
24 | | ^^ the trait `Trait` cannot be made into an object | |
25 | | | |
1b1a35ee | 26 | = note: required because of the requirements on the impl of `CoerceUnsized<&dyn Trait>` for `&S` |
e74abb32 XL |
27 | = note: required by cast to type `&dyn Trait` |
28 | ||
29 | error[E0038]: the trait `Trait` cannot be made into an object | |
30 | --> $DIR/wf-unsafe-trait-obj-match.rs:25:25 | |
31 | | | |
74b04a01 XL |
32 | LL | trait Trait: Sized {} |
33 | | ----- ----- ...because it requires `Self: Sized` | |
34 | | | | |
35 | | this trait cannot be made into an object... | |
36 | ... | |
e74abb32 XL |
37 | LL | let t: &dyn Trait = match opt() { |
38 | | ^^^^^^^^^^^ the trait `Trait` cannot be made into an object | |
39 | | | |
1b1a35ee | 40 | = note: required because of the requirements on the impl of `CoerceUnsized<&dyn Trait>` for `&R` |
e74abb32 XL |
41 | = note: required by cast to type `&dyn Trait` |
42 | ||
43 | error: aborting due to 3 previous errors | |
44 | ||
45 | Some errors have detailed explanations: E0038, E0308. | |
46 | For more information about an error, try `rustc --explain E0038`. |