summaryrefslogtreecommitdiffstats
path: root/tests/ui/privacy/private-field-ty-err.rs
blob: 10db606956722b35413f9ca04e563d60dc10a35d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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
        }
    }
}