2020-01-19 17:27:37 -08:00
|
|
|
error: associated item referring to unboxed trait object for its own trait
|
|
|
|
--> $DIR/object-unsafe-trait-should-use-self.rs:3:13
|
|
|
|
|
|
|
|
|
LL | trait A: Sized {
|
|
|
|
| - in this trait
|
|
|
|
LL | fn f(a: A) -> A;
|
|
|
|
| ^ ^
|
|
|
|
|
|
2020-01-25 14:28:23 -08:00
|
|
|
help: you might have meant to use `Self` to refer to the implementing type
|
2020-01-19 17:27:37 -08:00
|
|
|
|
|
|
|
|
LL | fn f(a: Self) -> Self;
|
|
|
|
| ^^^^ ^^^^
|
|
|
|
|
|
|
|
error[E0038]: the trait `A` cannot be made into an object
|
|
|
|
--> $DIR/object-unsafe-trait-should-use-self.rs:3:13
|
|
|
|
|
|
|
|
|
LL | trait A: Sized {
|
2020-01-31 16:47:00 -08:00
|
|
|
| - ----- ...because it requires `Self: Sized`
|
|
|
|
| |
|
|
|
|
| this trait cannot be made into an object...
|
2020-01-19 17:27:37 -08:00
|
|
|
LL | fn f(a: A) -> A;
|
|
|
|
| ^ the trait `A` cannot be made into an object
|
|
|
|
|
|
|
|
error: associated item referring to unboxed trait object for its own trait
|
|
|
|
--> $DIR/object-unsafe-trait-should-use-self.rs:8:13
|
|
|
|
|
|
|
|
|
LL | trait B {
|
|
|
|
| - in this trait
|
|
|
|
LL | fn f(a: B) -> B;
|
|
|
|
| ^ ^
|
|
|
|
|
|
2020-01-25 14:28:23 -08:00
|
|
|
help: you might have meant to use `Self` to refer to the implementing type
|
2020-01-19 17:27:37 -08:00
|
|
|
|
|
|
|
|
LL | fn f(a: Self) -> Self;
|
|
|
|
| ^^^^ ^^^^
|
|
|
|
|
|
|
|
error[E0038]: the trait `B` cannot be made into an object
|
|
|
|
--> $DIR/object-unsafe-trait-should-use-self.rs:8:13
|
|
|
|
|
|
2020-01-31 16:47:00 -08:00
|
|
|
LL | trait B {
|
|
|
|
| - this trait cannot be made into an object...
|
2020-01-19 17:27:37 -08:00
|
|
|
LL | fn f(a: B) -> B;
|
|
|
|
| - ^ the trait `B` cannot be made into an object
|
|
|
|
| |
|
2020-01-31 16:47:00 -08:00
|
|
|
| ...because associated function `f` has no `self` parameter
|
|
|
|
|
|
|
|
|
= help: consider turning `f` into a method by giving it a `&self` argument or constraining it with `where Self: Sized`
|
2020-01-19 17:27:37 -08:00
|
|
|
|
|
|
|
error: aborting due to 4 previous errors
|
|
|
|
|
|
|
|
For more information about this error, try `rustc --explain E0038`.
|