There seems to be a rule missing from the object safety list: https://github.com/rust-lang/reference/blob/master/src/items/traits.md#object-safety
I'm not sure how to properly word the rule, but it something along that lines that "Supertraits cannot reference Self as a type parameter".
This restriction was introduced in rust-lang/rust#22452.
Some examples:
traitSuper<T: ?Sized>{}traitWithSelf:Super<Self>{}structS;impl<A>Super<A>forS{}implWithSelfforS{}let obj:Box<dynWithSelf> = Box::new(S);// ERROR: `Self` in type parameter// Slight variation using default type.traitSuper<T: ?Sized = Self>{}traitWithSelf:Super{}structS;implSuperforS{}implWithSelfforS{}let obj:Box<dynWithSelf> = Box::new(S);// ERROR: `Self` in type parameterIs it correct that this rule should be added to the list? If so, can someone write down the proper wording?
There seems to be a rule missing from the object safety list: https://github.com/rust-lang/reference/blob/master/src/items/traits.md#object-safety
I'm not sure how to properly word the rule, but it something along that lines that "Supertraits cannot reference
Selfas a type parameter".This restriction was introduced in rust-lang/rust#22452.
Some examples:
Is it correct that this rule should be added to the list? If so, can someone write down the proper wording?