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
19 | ^^ `Trait` cannot be made into an object
21 note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
22 --> $DIR/wf-unsafe-trait-obj-match.rs:6:14
24 LL | trait Trait: Sized {}
25 | ----- ^^^^^ ...because it requires `Self: Sized`
27 | this trait cannot be made into an object...
28 = note: required because of the requirements on the impl of `CoerceUnsized<&dyn Trait>` for `&S`
29 = note: required by cast to type `&dyn Trait`
31 error[E0038]: the trait `Trait` cannot be made into an object
32 --> $DIR/wf-unsafe-trait-obj-match.rs:25:25
34 LL | let t: &dyn Trait = match opt() {
35 | ^^^^^^^^^^^ `Trait` cannot be made into an object
37 note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
38 --> $DIR/wf-unsafe-trait-obj-match.rs:6:14
40 LL | trait Trait: Sized {}
41 | ----- ^^^^^ ...because it requires `Self: Sized`
43 | this trait cannot be made into an object...
44 = note: required because of the requirements on the impl of `CoerceUnsized<&dyn Trait>` for `&R`
45 = note: required by cast to type `&dyn Trait`
47 error: aborting due to 3 previous errors
49 Some errors have detailed explanations: E0038, E0308.
50 For more information about an error, try `rustc --explain E0038`.