1 error[E0308]: `match` arms have incompatible types
2 --> $DIR/wf-unsafe-trait-obj-match.rs:23:17
6 | | -- this is found to be of type `&S`
8 | | ^^ expected struct `S`, found struct `R`
10 | |_____- `match` arms have incompatible types
12 = note: expected type `&S`
15 error[E0038]: the trait `Trait` cannot be made into an object
16 --> $DIR/wf-unsafe-trait-obj-match.rs:26:21
18 LL | trait Trait: Sized {}
19 | ----- traits that require `Self: Sized` cannot be made into an object
22 | ^^ the trait `Trait` cannot be made into an object
24 = note: required because of the requirements on the impl of `std::ops::CoerceUnsized<&dyn Trait>` for `&S`
25 = note: required by cast to type `&dyn Trait`
27 error[E0038]: the trait `Trait` cannot be made into an object
28 --> $DIR/wf-unsafe-trait-obj-match.rs:25:25
30 LL | trait Trait: Sized {}
31 | ----- traits that require `Self: Sized` cannot be made into an object
33 LL | let t: &dyn Trait = match opt() {
34 | ^^^^^^^^^^^ the trait `Trait` cannot be made into an object
36 = note: required because of the requirements on the impl of `std::ops::CoerceUnsized<&dyn Trait>` for `&R`
37 = note: required by cast to type `&dyn Trait`
39 error: aborting due to 3 previous errors
41 Some errors have detailed explanations: E0038, E0308.
42 For more information about an error, try `rustc --explain E0038`.