1 error[E0038]: the trait `Foo` cannot be made into an object
2 --> $DIR/arbitrary-self-types-not-object-safe.rs:33:32
4 LL | fn foo(self: &Rc<Self>) -> usize;
5 | --------- help: consider changing method `foo`'s `self` parameter to be `&self`: `&Self`
7 LL | let x = Rc::new(5usize) as Rc<dyn Foo>;
8 | ^^^^^^^^^^^ `Foo` cannot be made into an object
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/arbitrary-self-types-not-object-safe.rs:8:18
14 | --- this trait cannot be made into an object...
15 LL | fn foo(self: &Rc<Self>) -> usize;
16 | ^^^^^^^^^ ...because method `foo`'s `self` parameter cannot be dispatched on
18 error[E0038]: the trait `Foo` cannot be made into an object
19 --> $DIR/arbitrary-self-types-not-object-safe.rs:33:13
21 LL | fn foo(self: &Rc<Self>) -> usize;
22 | --------- help: consider changing method `foo`'s `self` parameter to be `&self`: `&Self`
24 LL | let x = Rc::new(5usize) as Rc<dyn Foo>;
25 | ^^^^^^^^^^^^^^^ `Foo` cannot be made into an object
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/arbitrary-self-types-not-object-safe.rs:8:18
31 | --- this trait cannot be made into an object...
32 LL | fn foo(self: &Rc<Self>) -> usize;
33 | ^^^^^^^^^ ...because method `foo`'s `self` parameter cannot be dispatched on
34 = note: required because of the requirements on the impl of `CoerceUnsized<Rc<dyn Foo>>` for `Rc<usize>`
35 = note: required by cast to type `Rc<dyn Foo>`
37 error: aborting due to 2 previous errors
39 For more information about this error, try `rustc --explain E0038`.