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
324 B
Rust
Raw Normal View History

mod a {
pub struct Foo {
pub x: isize
}
impl Foo {
2013-08-08 03:20:06 +00:00
fn foo(&self) {}
}
}
2016-02-23 00:22:52 +00: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-23 00:22:52 +00:00
s.bar();
2020-03-05 03:03:15 +00:00
s.foo(); //~ ERROR associated function `foo` is private
}