E4046#
A public definition cannot depend on private entities.
Erroneous Example#
priv trait I {
m(Self) -> Unit
}
pub impl I for Int with m(self) {
ignore(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:
pub(open) trait I {
m(Self) -> Unit
}
pub impl I for Int with m(self) {
ignore(self)
}
pub fn call_i(x : Int) -> Unit {
I::m(x)
}