summaryrefslogtreecommitdiffstats
path: root/tests/ui/privacy/restricted/lookup-ignores-private.rs
blob: 240ce1e2b03b6605434a8d32735e26ce71ef9bb4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// build-pass (FIXME(62277): could be check-pass?)
#![allow(warnings)]

mod foo {
    pub use foo::bar::S;
    mod bar {
        #[derive(Default)]
        pub struct S {
            pub(in foo) x: i32,
        }
        impl S {
            pub(in foo) fn f(&self) -> i32 { 0 }
        }

        pub struct S2 {
            pub(crate) x: bool,
        }
        impl S2 {
            pub(crate) fn f(&self) -> bool { false }
        }

        impl ::std::ops::Deref for S {
            type Target = S2;
            fn deref(&self) -> &S2 { unimplemented!() }
        }
    }
}


fn main() {
    let s = foo::S::default();
    let _: bool = s.x;
    let _: bool = s.f();
}