]>
Commit | Line | Data |
---|---|---|
f2b60f7d FG |
1 | error[E0038]: the trait `Foo` cannot be made into an object |
2 | --> $DIR/object-safety.rs:17:33 | |
3 | | | |
4 | LL | let i = Box::new(42_u32) as Box<dyn Foo>; | |
5 | | ^^^^^^^^^^^^ `Foo` 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> | |
487cf647 | 8 | --> $DIR/object-safety.rs:7:22 |
f2b60f7d FG |
9 | | |
10 | LL | trait Foo { | |
11 | | --- this trait cannot be made into an object... | |
12 | LL | fn baz(&self) -> impl Debug; | |
487cf647 | 13 | | ^^^^^^^^^^ ...because method `baz` references an `impl Trait` type in its return type |
f2b60f7d FG |
14 | = help: consider moving `baz` to another trait |
15 | ||
16 | error[E0038]: the trait `Foo` cannot be made into an object | |
17 | --> $DIR/object-safety.rs:20:13 | |
18 | | | |
19 | LL | let s = i.baz(); | |
20 | | ^^^^^^^ `Foo` cannot be made into an object | |
21 | | | |
22 | 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> | |
487cf647 | 23 | --> $DIR/object-safety.rs:7:22 |
f2b60f7d FG |
24 | | |
25 | LL | trait Foo { | |
26 | | --- this trait cannot be made into an object... | |
27 | LL | fn baz(&self) -> impl Debug; | |
487cf647 | 28 | | ^^^^^^^^^^ ...because method `baz` references an `impl Trait` type in its return type |
f2b60f7d FG |
29 | = help: consider moving `baz` to another trait |
30 | ||
31 | error[E0038]: the trait `Foo` cannot be made into an object | |
32 | --> $DIR/object-safety.rs:17:13 | |
33 | | | |
34 | LL | let i = Box::new(42_u32) as Box<dyn Foo>; | |
35 | | ^^^^^^^^^^^^^^^^ `Foo` cannot be made into an object | |
36 | | | |
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> | |
487cf647 | 38 | --> $DIR/object-safety.rs:7:22 |
f2b60f7d FG |
39 | | |
40 | LL | trait Foo { | |
41 | | --- this trait cannot be made into an object... | |
42 | LL | fn baz(&self) -> impl Debug; | |
487cf647 | 43 | | ^^^^^^^^^^ ...because method `baz` references an `impl Trait` type in its return type |
f2b60f7d FG |
44 | = help: consider moving `baz` to another trait |
45 | = note: required for `Box<u32>` to implement `CoerceUnsized<Box<dyn Foo>>` | |
46 | = note: required by cast to type `Box<dyn Foo>` | |
47 | ||
48 | error: aborting due to 3 previous errors | |
49 | ||
50 | For more information about this error, try `rustc --explain E0038`. |