Skip to content

Fat pointer trait implementations #28579

Closed
@Diggsey

Description

@Diggsey

Currently Hash is only implemented for thin pointers, and Eq/PartialEq aren't implemented for any pointers (but == works for all pointers).

All of these traits should be implemented for all pointers.

Without this, it's impossible to implement generic reference-equality semantics that support dynamically sized types, even in unsafe code, thanks to #27570. Even with #27570 it will still be impossible to do safely on stable rust, since raw::TraitObject is unstable, and even if it were stable, the type system isn't powerful enough to express when to use raw::TraitObject vs a thin pointer.

Fixing this properly will likely require improvements to the type system. Any improvement which solves rust-lang/rfcs#1279 should be enough.

Metadata

Metadata

Assignees

No one assigned

    Labels

    T-langRelevant to the language team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions