]> git.lizzy.rs Git - rust.git/blob - tests/ui/privacy/restricted/lookup-ignores-private.rs
Rollup merge of #106664 - chenyukang:yukang/fix-106597-remove-lseek, r=cuviper
[rust.git] / tests / ui / privacy / restricted / lookup-ignores-private.rs
1 // build-pass (FIXME(62277): could be check-pass?)
2 #![allow(warnings)]
3
4 mod foo {
5     pub use foo::bar::S;
6     mod bar {
7         #[derive(Default)]
8         pub struct S {
9             pub(in foo) x: i32,
10         }
11         impl S {
12             pub(in foo) fn f(&self) -> i32 { 0 }
13         }
14
15         pub struct S2 {
16             pub(crate) x: bool,
17         }
18         impl S2 {
19             pub(crate) fn f(&self) -> bool { false }
20         }
21
22         impl ::std::ops::Deref for S {
23             type Target = S2;
24             fn deref(&self) -> &S2 { unimplemented!() }
25         }
26     }
27 }
28
29
30 fn main() {
31     let s = foo::S::default();
32     let _: bool = s.x;
33     let _: bool = s.f();
34 }