2 // Check we do not select a private method or field when computing autoderefs
7 pub struct Bar2 { i: i32 }
12 fn f(&self) -> bool { true }
17 pub struct Bar { i: ::Bar2 }
19 pub struct Baz(::Baz2);
22 fn f(&self) -> bool { false }
25 impl ::std::ops::Deref for Bar {
27 fn deref(&self) -> &::Bar2 { &self.i }
30 impl ::std::ops::Deref for Baz {
32 fn deref(&self) -> &::Baz2 { &self.0 }
35 pub fn f(bar: &Bar, baz: &Baz) {
36 // Since the private fields and methods are visible here, there should be no autoderefs.
37 let _: &::Bar2 = &bar.i;
38 let _: &::Baz2 = &baz.0;
44 let bar = foo::Bar::default();
45 let baz = foo::Baz::default();