]> git.lizzy.rs Git - rust.git/blob - tests/ui/suggestions/field-access-considering-privacy.rs
Rollup merge of #106751 - clubby789:const-intrinsic, r=GuillaumeGomez
[rust.git] / tests / ui / suggestions / field-access-considering-privacy.rs
1 use a::TyCtxt;
2
3 mod a {
4     use std::ops::Deref;
5     pub struct TyCtxt<'tcx> {
6         gcx: &'tcx GlobalCtxt<'tcx>,
7     }
8
9     impl<'tcx> Deref for TyCtxt<'tcx> {
10         type Target = &'tcx GlobalCtxt<'tcx>;
11
12         fn deref(&self) -> &Self::Target {
13             &self.gcx
14         }
15     }
16
17     pub struct GlobalCtxt<'tcx> {
18         pub sess: &'tcx Session,
19         _t: &'tcx (),
20     }
21
22     pub struct Session {
23         pub opts: (),
24     }
25 }
26
27 mod b {
28     fn foo<'tcx>(tcx: crate::TyCtxt<'tcx>) {
29         tcx.opts;
30         //~^ ERROR no field `opts` on type `TyCtxt<'tcx>`
31         //~| HELP one of the expressions' fields has a field of the same name
32     }
33 }
34
35 fn main() {}