fork/rust
git clone https://git.julia.blue/fork/rust
3bcad65fbf6
master
1error[E0308]: `match` arms have incompatible types 2 --> $DIR/wf-unsafe-trait-obj-match.rs:23:17 3 | 4LL | / match opt() { 5LL | | Some(()) => &S, 6 | | -- this is found to be of type `&S` 7LL | | None => &R, 8 | | ^^ expected `&S`, found `&R` 9LL | | } 10 | |_____- `match` arms have incompatible types 11 | 12 = note: expected reference `&S` 13 found reference `&R` 14 15error[E0038]: the trait `Trait` cannot be made into an object 16 --> $DIR/wf-unsafe-trait-obj-match.rs:26:21 17 | 18LL | Some(()) => &S, 19 | ^^ `Trait` cannot be made into an object 20 | 21note: 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 23 | 24LL | trait Trait: Sized {} 25 | ----- ^^^^^ ...because it requires `Self: Sized` 26 | | 27 | this trait cannot be made into an object... 28 = note: required for the cast from `&S` to `&dyn Trait` 29 30error[E0038]: the trait `Trait` cannot be made into an object 31 --> $DIR/wf-unsafe-trait-obj-match.rs:25:25 32 | 33LL | let t: &dyn Trait = match opt() { 34 | _________________________^ 35LL | | Some(()) => &S, 36LL | | None => &R, 37LL | | }; 38 | |_____^ `Trait` cannot be made into an object 39 | 40note: 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> 41 --> $DIR/wf-unsafe-trait-obj-match.rs:6:14 42 | 43LL | trait Trait: Sized {} 44 | ----- ^^^^^ ...because it requires `Self: Sized` 45 | | 46 | this trait cannot be made into an object... 47 = note: required for the cast from `&R` to `&dyn Trait` 48 49error: aborting due to 3 previous errors 50 51Some errors have detailed explanations: E0038, E0308. 52For more information about an error, try `rustc --explain E0038`.