mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-23 23:34:48 +00:00
49 lines
2.0 KiB
Plaintext
49 lines
2.0 KiB
Plaintext
error[E0311]: the parameter type `Self` may not live long enough
|
|
|
|
|
note: the parameter type `Self` must be valid for the lifetime `'a` as defined here...
|
|
--> $DIR/object-safety-supertrait-mentions-GAT.rs:9:26
|
|
|
|
|
LL | trait SuperTrait<T>: for<'a> GatTrait<Gat<'a> = T> {
|
|
| ^^
|
|
= help: consider adding an explicit lifetime bound `Self: 'a`...
|
|
= note: ...so that the type `Self` will meet its required lifetime bounds...
|
|
note: ...that is required by this bound
|
|
--> $DIR/object-safety-supertrait-mentions-GAT.rs:6:15
|
|
|
|
|
LL | Self: 'a;
|
|
| ^^
|
|
|
|
error: associated item referring to unboxed trait object for its own trait
|
|
--> $DIR/object-safety-supertrait-mentions-GAT.rs:10:20
|
|
|
|
|
LL | trait SuperTrait<T>: for<'a> GatTrait<Gat<'a> = T> {
|
|
| ---------- in this trait
|
|
LL | fn c(&self) -> dyn SuperTrait<T>;
|
|
| ^^^^^^^^^^^^^^^^^
|
|
|
|
|
help: you might have meant to use `Self` to refer to the implementing type
|
|
|
|
|
LL | fn c(&self) -> Self;
|
|
| ~~~~
|
|
|
|
error[E0038]: the trait `SuperTrait` cannot be made into an object
|
|
--> $DIR/object-safety-supertrait-mentions-GAT.rs:10:20
|
|
|
|
|
LL | fn c(&self) -> dyn SuperTrait<T>;
|
|
| ^^^^^^^^^^^^^^^^^ `SuperTrait` cannot be made into an object
|
|
|
|
|
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>
|
|
--> $DIR/object-safety-supertrait-mentions-GAT.rs:4:10
|
|
|
|
|
LL | type Gat<'a>
|
|
| ^^^ ...because it contains the generic associated type `Gat`
|
|
...
|
|
LL | trait SuperTrait<T>: for<'a> GatTrait<Gat<'a> = T> {
|
|
| ---------- this trait cannot be made into an object...
|
|
= help: consider moving `Gat` to another trait
|
|
|
|
error: aborting due to 3 previous errors
|
|
|
|
Some errors have detailed explanations: E0038, E0311.
|
|
For more information about an error, try `rustc --explain E0038`.
|