-
Notifications
You must be signed in to change notification settings - Fork 488
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add rule to object safety? #756
Comments
This apparently doesn't only apply for supertraits that use trait PartialEq<Rhs = Self> I suggest adding
together with an expanded example to show that this applies even when For reference, this is the compiler error describing the same rule:
Happy to make a PR where exact language can be agreed if this is desirable. |
I asked over at https://rust-lang.zulipchat.com/#narrow/stream/213817-t-lang/topic/object.20safety.20of.20Self.20in.20supertraits for some suggestions. Someone noted rust-lang/rust#88904 as a strange edge case, but I am uncertain if that is just a bug. What you have suggested above sounds good to me, and would be happy to take a PR. |
Happy to. Will be delayed until I get permission from my new job but I don't see that being a problem. |
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:
Is it correct that this rule should be added to the list? If so, can someone write down the proper wording?
The text was updated successfully, but these errors were encountered: