]> git.lizzy.rs Git - rust.git/blob - src/test/ui/wf/wf-unsafe-trait-obj-match.stderr
Point at `Sized` bound
[rust.git] / src / test / ui / wf / wf-unsafe-trait-obj-match.stderr
1 error[E0308]: `match` arms have incompatible types
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    |
12    = note:   expected type `&S`
13            found reference `&R`
14
15 error[E0038]: the trait `Trait` cannot be made into an object
16   --> $DIR/wf-unsafe-trait-obj-match.rs:26:21
17    |
18 LL | trait Trait: Sized {}
19    |              ----- the trait cannot require that `Self : Sized`
20 ...
21 LL |         Some(()) => &S,
22    |                     ^^ the trait `Trait` cannot be made into an object
23    |
24    = note: the trait cannot require that `Self : Sized`
25    = note: required because of the requirements on the impl of `std::ops::CoerceUnsized<&dyn Trait>` for `&S`
26    = note: required by cast to type `&dyn Trait`
27
28 error[E0038]: the trait `Trait` cannot be made into an object
29   --> $DIR/wf-unsafe-trait-obj-match.rs:25:25
30    |
31 LL | trait Trait: Sized {}
32    |              ----- the trait cannot require that `Self : Sized`
33 ...
34 LL |     let t: &dyn Trait = match opt() {
35    |                         ^^^^^^^^^^^ the trait `Trait` cannot be made into an object
36    |
37    = note: the trait cannot require that `Self : Sized`
38    = note: required because of the requirements on the impl of `std::ops::CoerceUnsized<&dyn Trait>` for `&R`
39    = note: required by cast to type `&dyn Trait`
40
41 error: aborting due to 3 previous errors
42
43 Some errors have detailed explanations: E0038, E0308.
44 For more information about an error, try `rustc --explain E0038`.