rust/tests/ui/privacy/private-impl-method.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

22 lines
311 B
Rust
Raw Normal View History

mod a {
pub struct Foo {
pub x: isize
}
impl Foo {
2013-08-07 22:20:06 -05:00
fn foo(&self) {}
}
}
2016-02-22 18:22:52 -06:00
fn f() {
impl a::Foo {
fn bar(&self) {} // This should be visible outside `f`
}
}
fn main() {
let s = a::Foo { x: 1 };
2016-02-22 18:22:52 -06:00
s.bar();
s.foo(); //~ ERROR method `foo` is private
}