Open
Description
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:
trait Super<T: ?Sized> {}
trait WithSelf: Super<Self> {}
struct S;
impl<A> Super<A> for S {}
impl WithSelf for S {}
let obj: Box<dyn WithSelf> = Box::new(S); // ERROR: `Self` in type parameter
// Slight variation using default type.
trait Super<T: ?Sized = Self> {}
trait WithSelf: Super {}
struct S;
impl Super for S {}
impl WithSelf for S {}
let obj: Box<dyn WithSelf> = Box::new(S); // ERROR: `Self` in type parameter
Is it correct that this rule should be added to the list? If so, can someone write down the proper wording?