]> git.lizzy.rs Git - rust.git/blob - tests/ui/wf/wf-convert-unsafe-trait-obj.stderr
Rollup merge of #104965 - zacklukem:p-option-as_ref-docs, r=scottmcm
[rust.git] / tests / ui / wf / wf-convert-unsafe-trait-obj.stderr
1 error[E0038]: the trait `Trait` cannot be made into an object
2   --> $DIR/wf-convert-unsafe-trait-obj.rs:16:25
3    |
4 LL |     let t: &dyn Trait = &S;
5    |                         ^^ `Trait` cannot be made into an object
6    |
7 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>
8   --> $DIR/wf-convert-unsafe-trait-obj.rs:6:14
9    |
10 LL | trait Trait: Sized {}
11    |       -----  ^^^^^ ...because it requires `Self: Sized`
12    |       |
13    |       this trait cannot be made into an object...
14    = note: required for `&S` to implement `CoerceUnsized<&dyn Trait>`
15    = note: required by cast to type `&dyn Trait`
16
17 error[E0038]: the trait `Trait` cannot be made into an object
18   --> $DIR/wf-convert-unsafe-trait-obj.rs:17:17
19    |
20 LL |     takes_trait(&S);
21    |                 ^^ `Trait` cannot be made into an object
22    |
23 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>
24   --> $DIR/wf-convert-unsafe-trait-obj.rs:6:14
25    |
26 LL | trait Trait: Sized {}
27    |       -----  ^^^^^ ...because it requires `Self: Sized`
28    |       |
29    |       this trait cannot be made into an object...
30    = note: required for `&S` to implement `CoerceUnsized<&dyn Trait>`
31    = note: required by cast to type `&dyn Trait`
32
33 error[E0038]: the trait `Trait` cannot be made into an object
34   --> $DIR/wf-convert-unsafe-trait-obj.rs:15:5
35    |
36 LL |     &S as &dyn Trait;
37    |     ^^ `Trait` cannot be made into an object
38    |
39 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>
40   --> $DIR/wf-convert-unsafe-trait-obj.rs:6:14
41    |
42 LL | trait Trait: Sized {}
43    |       -----  ^^^^^ ...because it requires `Self: Sized`
44    |       |
45    |       this trait cannot be made into an object...
46    = note: required for `&S` to implement `CoerceUnsized<&dyn Trait>`
47    = note: required by cast to type `&dyn Trait`
48
49 error: aborting due to 3 previous errors
50
51 For more information about this error, try `rustc --explain E0038`.