Chih-Hung Hsieh | 2ccedcd | 2019-12-19 15:10:50 -0800 | [diff] [blame] | 1 | error[E0038]: the trait `Bar` cannot be made into an object |
| 2 | --> $DIR/object-safety-mentions-Self.rs:24:5 |
| 3 | | |
Thiébaud Weksteen | 5bd94c1 | 2021-01-06 15:18:42 +0100 | [diff] [blame] | 4 | LL | t |
| 5 | | ^ `Bar` cannot be made into an object |
| 6 | | |
Thiébaud Weksteen | 5bd94c1 | 2021-01-06 15:18:42 +0100 | [diff] [blame] | 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/object-safety-mentions-Self.rs:11:22 |
| 9 | | |
Matthew Maurer | 15a6560 | 2020-04-24 14:05:21 -0700 | [diff] [blame] | 10 | LL | trait Bar { |
| 11 | | --- this trait cannot be made into an object... |
Chih-Hung Hsieh | 2ccedcd | 2019-12-19 15:10:50 -0800 | [diff] [blame] | 12 | LL | fn bar(&self, x: &Self); |
Thiébaud Weksteen | 5bd94c1 | 2021-01-06 15:18:42 +0100 | [diff] [blame] | 13 | | ^^^^^ ...because method `bar` references the `Self` type in this parameter |
Chris Wailes | a153842 | 2021-12-02 10:37:12 -0800 | [diff] [blame] | 14 | = help: consider moving `bar` to another trait |
Chris Wailes | cd1aefd | 2023-07-13 13:36:21 -0700 | [diff] [blame^] | 15 | = note: required for the cast from `&T` to `&dyn Bar` |
Chih-Hung Hsieh | 2ccedcd | 2019-12-19 15:10:50 -0800 | [diff] [blame] | 16 | |
| 17 | error[E0038]: the trait `Baz` cannot be made into an object |
| 18 | --> $DIR/object-safety-mentions-Self.rs:30:5 |
| 19 | | |
Thiébaud Weksteen | 5bd94c1 | 2021-01-06 15:18:42 +0100 | [diff] [blame] | 20 | LL | t |
| 21 | | ^ `Baz` cannot be made into an object |
| 22 | | |
Thiébaud Weksteen | 5bd94c1 | 2021-01-06 15:18:42 +0100 | [diff] [blame] | 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/object-safety-mentions-Self.rs:15:22 |
| 25 | | |
Matthew Maurer | 15a6560 | 2020-04-24 14:05:21 -0700 | [diff] [blame] | 26 | LL | trait Baz { |
| 27 | | --- this trait cannot be made into an object... |
Chih-Hung Hsieh | 2ccedcd | 2019-12-19 15:10:50 -0800 | [diff] [blame] | 28 | LL | fn baz(&self) -> Self; |
Thiébaud Weksteen | 5bd94c1 | 2021-01-06 15:18:42 +0100 | [diff] [blame] | 29 | | ^^^^ ...because method `baz` references the `Self` type in its return type |
Chris Wailes | a153842 | 2021-12-02 10:37:12 -0800 | [diff] [blame] | 30 | = help: consider moving `baz` to another trait |
Chris Wailes | cd1aefd | 2023-07-13 13:36:21 -0700 | [diff] [blame^] | 31 | = note: required for the cast from `&T` to `&dyn Baz` |
Chih-Hung Hsieh | 2ccedcd | 2019-12-19 15:10:50 -0800 | [diff] [blame] | 32 | |
| 33 | error: aborting due to 2 previous errors |
| 34 | |
| 35 | For more information about this error, try `rustc --explain E0038`. |