E4010

E4010#

pub is not allowed on default implementation for traits. The default implementation has the same visibility as the trait itself.

Erroneous Example#

pub(open) trait Stringer {
  stringify(Self) -> String
}

pub impl Stringer with stringify(_self) { "hey" }

In the example above, the pub keyword is used on the default implementation of the Stringer trait, which is not allowed.

Suggestion#

Remove the pub keyword so that the default implementation has the same visibility as the trait itself:

pub(open) trait Stringer {
  stringify(Self) -> String
}

impl Stringer with stringify(_self) { "hey" }