Closed
Description
I'm not 100% sure how the privacy rules should work.
A's methods should not be callable because the trait is private, but it's reachable though the trait C that inherits A, by calling C::a()
.
B's methods are reachable the same way, even if it's marked pub but not publically reachable.
pub use inner::C;
mod inner {
trait A {
fn a(&self) { }
}
pub trait B {
fn b(&self) { }
}
pub trait C: A + B {
fn c(&self) { }
}
impl A for i32 {}
impl B for i32 {}
impl C for i32 {}
}
fn main() {
// A is private
// B is pub, not reexported
// C : A + B is pub, reexported
// 0.a(); // can't call
// 0.b(); // can't call
0.c(); // ok
C::a(&0); // can call
C::b(&0); // can call
C::c(&0); // ok
}