|
| 1 | +error[E0038]: the trait `Trait` cannot be made into an object |
| 2 | + --> $DIR/feature-gate-dispatch-from-dyn-missing-impl.rs:32:25 |
| 3 | + | |
| 4 | +LL | fn ptr(self: Ptr<Self>); |
| 5 | + | --------- help: consider changing method `ptr`'s `self` parameter to be `&self`: `&Self` |
| 6 | +... |
| 7 | +LL | Ptr(Box::new(4)) as Ptr<dyn Trait>; |
| 8 | + | ^^^^^^^^^^^^^^ `Trait` cannot be made into an object |
| 9 | + | |
| 10 | +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> |
| 11 | + --> $DIR/feature-gate-dispatch-from-dyn-missing-impl.rs:25:18 |
| 12 | + | |
| 13 | +LL | trait Trait { |
| 14 | + | ----- this trait cannot be made into an object... |
| 15 | +LL | fn ptr(self: Ptr<Self>); |
| 16 | + | ^^^^^^^^^ ...because method `ptr`'s `self` parameter cannot be dispatched on |
| 17 | + |
| 18 | +error[E0038]: the trait `Trait` cannot be made into an object |
| 19 | + --> $DIR/feature-gate-dispatch-from-dyn-missing-impl.rs:32:5 |
| 20 | + | |
| 21 | +LL | fn ptr(self: Ptr<Self>); |
| 22 | + | --------- help: consider changing method `ptr`'s `self` parameter to be `&self`: `&Self` |
| 23 | +... |
| 24 | +LL | Ptr(Box::new(4)) as Ptr<dyn Trait>; |
| 25 | + | ^^^^^^^^^^^^^^^^ `Trait` cannot be made into an object |
| 26 | + | |
| 27 | +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> |
| 28 | + --> $DIR/feature-gate-dispatch-from-dyn-missing-impl.rs:25:18 |
| 29 | + | |
| 30 | +LL | trait Trait { |
| 31 | + | ----- this trait cannot be made into an object... |
| 32 | +LL | fn ptr(self: Ptr<Self>); |
| 33 | + | ^^^^^^^^^ ...because method `ptr`'s `self` parameter cannot be dispatched on |
| 34 | +note: required for `Ptr<{integer}>` to implement `CoerceUnsized<Ptr<dyn Trait>>` |
| 35 | + --> $DIR/feature-gate-dispatch-from-dyn-missing-impl.rs:20:40 |
| 36 | + | |
| 37 | +LL | impl<T: Unsize<U> + ?Sized, U: ?Sized> CoerceUnsized<Ptr<U>> for Ptr<T> {} |
| 38 | + | --------- ^^^^^^^^^^^^^^^^^^^^^ ^^^^^^ |
| 39 | + | | |
| 40 | + | unsatisfied trait bound introduced here |
| 41 | + = note: required by cast to type `Ptr<dyn Trait>` |
| 42 | + |
| 43 | +error: aborting due to 2 previous errors |
| 44 | + |
| 45 | +For more information about this error, try `rustc --explain E0038`. |
0 commit comments