]> git.lizzy.rs Git - rust.git/blob - src/test/ui/type/type-parameter-defaults-referencing-Self-ppaux.stderr
Merge commit '23d11428de3e973b34a5090a78d62887f821c90e' into clippyup
[rust.git] / src / test / ui / type / type-parameter-defaults-referencing-Self-ppaux.stderr
1 error[E0620]: cast to unsized type: `i32` as `dyn MyAdd<i32>`
2   --> $DIR/type-parameter-defaults-referencing-Self-ppaux.rs:14:13
3    |
4 LL |     let y = x as dyn MyAdd<i32>;
5    |             ^^^^^^^^^^^^^^^^^^^
6    |
7 help: consider using a box or reference as appropriate
8   --> $DIR/type-parameter-defaults-referencing-Self-ppaux.rs:14:13
9    |
10 LL |     let y = x as dyn MyAdd<i32>;
11    |             ^
12
13 error[E0038]: the trait `MyAdd` cannot be made into an object
14   --> $DIR/type-parameter-defaults-referencing-Self-ppaux.rs:14:18
15    |
16 LL |     let y = x as dyn MyAdd<i32>;
17    |                  ^^^^^^^^^^^^^^ `MyAdd` cannot be made into an object
18    |
19 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>
20   --> $DIR/type-parameter-defaults-referencing-Self-ppaux.rs:6:55
21    |
22 LL | trait MyAdd<Rhs=Self> { fn add(&self, other: &Rhs) -> Self; }
23    |       -----                                           ^^^^ ...because method `add` references the `Self` type in its return type
24    |       |
25    |       this trait cannot be made into an object...
26    = help: consider moving `add` to another trait
27
28 error: aborting due to 2 previous errors
29
30 Some errors have detailed explanations: E0038, E0620.
31 For more information about an error, try `rustc --explain E0038`.