rust/src/test/compile-fail/private-method-inherited.rs

16 lines
210 B
Rust
Raw Normal View History

// Tests that inherited visibility applies to methods.
mod a {
pub struct Foo;
impl Foo {
fn f(self) {}
}
}
fn main() {
let x = a::Foo;
x.f(); //~ ERROR method `f` is private
}