fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #67350 - Mark-Simulacrum:stable-next, r=Mark-Simulacrum73528e339aa

1.40.0
1.5 KiB38 linesraw
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 struct `S`, found struct `R`
9LL | |     }
10   | |_____- `match` arms have incompatible types
11   |
12   = note: expected type `&S`
13              found type `&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   |                     ^^ the trait `Trait` cannot be made into an object
20   |
21   = note: the trait cannot require that `Self : Sized`
22   = note: required because of the requirements on the impl of `std::ops::CoerceUnsized<&dyn Trait>` for `&S`
23   = note: required by cast to type `&dyn Trait`
24
25error[E0038]: the trait `Trait` cannot be made into an object
26  --> $DIR/wf-unsafe-trait-obj-match.rs:25:25
27   |
28LL |     let t: &dyn Trait = match opt() {
29   |                         ^^^^^^^^^^^ the trait `Trait` cannot be made into an object
30   |
31   = note: the trait cannot require that `Self : Sized`
32   = note: required because of the requirements on the impl of `std::ops::CoerceUnsized<&dyn Trait>` for `&R`
33   = note: required by cast to type `&dyn Trait`
34
35error: aborting due to 3 previous errors
36
37Some errors have detailed explanations: E0038, E0308.
38For more information about an error, try `rustc --explain E0038`.