Skip to content

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

Closed as not planned
@jmaargh

Description

@jmaargh

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions