• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1error[E0038]: the trait `Trait` cannot be made into an object
2  --> $DIR/feature-gate-dispatch-from-dyn-missing-impl.rs:32:25
3   |
4LL |     fn ptr(self: Ptr<Self>);
5   |                  --------- help: consider changing method `ptr`'s `self` parameter to be `&self`: `&Self`
6...
7LL |     Ptr(Box::new(4)) as Ptr<dyn Trait>;
8   |                         ^^^^^^^^^^^^^^ `Trait` cannot be made into an object
9   |
10note: 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   |
13LL | trait Trait {
14   |       ----- this trait cannot be made into an object...
15LL |     fn ptr(self: Ptr<Self>);
16   |                  ^^^^^^^^^ ...because method `ptr`'s `self` parameter cannot be dispatched on
17
18error[E0038]: the trait `Trait` cannot be made into an object
19  --> $DIR/feature-gate-dispatch-from-dyn-missing-impl.rs:32:5
20   |
21LL |     fn ptr(self: Ptr<Self>);
22   |                  --------- help: consider changing method `ptr`'s `self` parameter to be `&self`: `&Self`
23...
24LL |     Ptr(Box::new(4)) as Ptr<dyn Trait>;
25   |     ^^^^^^^^^^^^^^^^ `Trait` cannot be made into an object
26   |
27note: 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   |
30LL | trait Trait {
31   |       ----- this trait cannot be made into an object...
32LL |     fn ptr(self: Ptr<Self>);
33   |                  ^^^^^^^^^ ...because method `ptr`'s `self` parameter cannot be dispatched on
34   = note: required for the cast from `Ptr<{integer}>` to `Ptr<dyn Trait>`
35
36error: aborting due to 2 previous errors
37
38For more information about this error, try `rustc --explain E0038`.
39