@@ -7,8 +7,8 @@ use rustc_ast::EnumDef;
77use rustc_data_structures:: intern:: Interned ;
88use rustc_hir:: def_id:: LocalDefId ;
99use rustc_hir:: def_id:: CRATE_DEF_ID ;
10+ use rustc_middle:: middle:: privacy:: Level ;
1011use rustc_middle:: middle:: privacy:: { EffectiveVisibilities , EffectiveVisibility } ;
11- use rustc_middle:: middle:: privacy:: { IntoDefIdTree , Level } ;
1212use rustc_middle:: ty:: { DefIdTree , Visibility } ;
1313use std:: mem;
1414
@@ -67,13 +67,6 @@ impl Resolver<'_, '_> {
6767 }
6868}
6969
70- impl < ' a , ' b , ' tcx > IntoDefIdTree for & ' b mut Resolver < ' a , ' tcx > {
71- type Tree = & ' b Resolver < ' a , ' tcx > ;
72- fn tree ( self ) -> Self :: Tree {
73- self
74- }
75- }
76-
7770impl < ' r , ' a , ' tcx > EffectiveVisibilitiesVisitor < ' r , ' a , ' tcx > {
7871 /// Fills the `Resolver::effective_visibilities` table with public & exported items
7972 /// For now, this doesn't resolve macros (FIXME) and cannot resolve Impl, as we
@@ -167,26 +160,28 @@ impl<'r, 'a, 'tcx> EffectiveVisibilitiesVisitor<'r, 'a, 'tcx> {
167160 let nominal_vis = binding. vis . expect_local ( ) ;
168161 let private_vis = self . cheap_private_vis ( parent_id) ;
169162 let inherited_eff_vis = self . effective_vis_or_private ( parent_id) ;
163+ let tcx = self . r . tcx ;
170164 self . changed |= self . import_effective_visibilities . update (
171165 binding,
172166 nominal_vis,
173- |r| ( private_vis. unwrap_or_else ( || r. private_vis_import ( binding) ) , r ) ,
167+ || private_vis. unwrap_or_else ( || self . r . private_vis_import ( binding) ) ,
174168 inherited_eff_vis,
175169 parent_id. level ( ) ,
176- & mut * self . r ,
170+ tcx ,
177171 ) ;
178172 }
179173
180174 fn update_def ( & mut self , def_id : LocalDefId , nominal_vis : Visibility , parent_id : ParentId < ' a > ) {
181175 let private_vis = self . cheap_private_vis ( parent_id) ;
182176 let inherited_eff_vis = self . effective_vis_or_private ( parent_id) ;
177+ let tcx = self . r . tcx ;
183178 self . changed |= self . def_effective_visibilities . update (
184179 def_id,
185180 nominal_vis,
186- |r| ( private_vis. unwrap_or_else ( || r. private_vis_def ( def_id) ) , r ) ,
181+ || private_vis. unwrap_or_else ( || self . r . private_vis_def ( def_id) ) ,
187182 inherited_eff_vis,
188183 parent_id. level ( ) ,
189- & mut * self . r ,
184+ tcx ,
190185 ) ;
191186 }
192187
0 commit comments