E4046#
A public definition cannot depend on private entities.
Erroneous Example#
priv trait I { m(Self) }
pub impl I for Int with m(self) {}
The above example tries to implement a private trait I
for the type Int
,
but the implementation itself is public, which is not allowed.
This gives the following error on line 2:
A public definition cannot depend on private trait
Suggestion#
Adjust the visibility of the trait or the implementation to match:
trait I { m(Self) -> Unit }
pub impl I for Int with m(self) {}
... or:
priv trait I { m(Self) -> Unit }
impl I for Int with m(self) {}