rust/tests/ui/privacy/private-field-ty-err.rs

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

21 lines
319 B
Rust
Raw Normal View History

fn main() {
let x = foo::Foo::default();
if x.len {
//~^ ERROR field `len` of struct `Foo` is private
println!("foo");
}
}
mod foo {
#[derive(Default)]
pub struct Foo {
len: String,
}
impl Foo {
pub fn len(&self) -> usize {
42
}
}
}