Skip to content

Section on Object Safety does not explicitly mention when Self is a type parameter #1437

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

Closed
jmaargh opened this issue Dec 13, 2023 · 1 comment

Comments

@jmaargh
Copy link

jmaargh commented Dec 13, 2023

The section on Object Safety defines that concept with a list of bullet points. That list does not include the case when the trait takes Self as a type parameter, but that is included as an example below the list.

// Not object safe if `Self` is a type argument.

I suggest adding a bullet of

  • A generic parameter of this trait, or any of its supertraits, is not specified to be Self

together with an expanded example to show that this applies even when Self: ?Sized. An example of this in action is PartialEq not being object safe.

If I get the thumbs-up I'll make a PR

@ehuss
Copy link
Contributor

ehuss commented Dec 13, 2023

Thanks for the report! Closing as a duplicate of #756.

Unfortunately I don't understand the rule introduced in rust-lang/rust#22452 well enough to articulate it in English. I'll try pinging the lang team again on Zulip.

@ehuss ehuss closed this as not planned Won't fix, can't repro, duplicate, stale Dec 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants