Skip to content

Error E0399 regression on nightly from beta. #27377

Description

@dylanede

I have found that with a trait of the form

trait Foo {
    type A = ();
    fn get_a(&self) -> Option<Self::A> { None }
    type B = ();
    fn get_b(&self) -> Option<Self::B> { None }
}

impl Foo for () {
    type A = ();
}

I get the following error message on nightly (as of the time of this post), but not on beta.

<anon>:9:5: 9:17 error: the following trait items need to be reimplemented as `A` was overridden: `get_a`, `B`, `get_b` [E0399]
<anon>:9     type A = ();

I can possibly understand get_a needing to be reimplemented, but B and get_b as well?
I don't get the error message when types do not have defaults, like so:

trait Foo {
    type A;
    fn get_a(&self) -> Option<Self::A> { None }
    type B = ();
    fn get_b(&self) -> Option<Self::B> { None }
}

impl Foo for () {
    type A = ();
}

Note that it no longer errors out saying that the methods need to be reimplemented.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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