Skip to content

Relax Trait Coherence rules to allow the implementation of a trait on generic types where the type must impl another trait owned by the current crate #1124

Open
@jnicholls

Description

@jnicholls

The title is lengthy, but it boils down to this:

If I have a trait MyRead and I want to implement Read for all T: MyRead, I should be able to do so because I own MyRead and the impl of Read would (should?) only come into scope for type T: MyRead if and only if MyRead is also in scope.

There must be a major hole I am missing, but this would seriously reduce code in a lot of libraries, i.e. implementing traits onto owned types individually.

Metadata

Metadata

Assignees

No one assigned

    Labels

    T-langRelevant to the language team, which will review and decide on the RFC.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions