@@ -10,7 +10,7 @@ use rustc_data_structures::fx::FxHashSet;
1010use rustc_errors:: struct_span_err;
1111use rustc_hir as hir;
1212use rustc_hir:: def:: { DefKind , Res } ;
13- use rustc_hir:: def_id:: { CrateNum , DefId , CRATE_DEF_INDEX , LOCAL_CRATE } ;
13+ use rustc_hir:: def_id:: { CrateNum , DefId , LocalDefId , CRATE_DEF_INDEX , LOCAL_CRATE } ;
1414use rustc_hir:: intravisit:: { self , DeepVisitor , NestedVisitorMap , Visitor } ;
1515use rustc_hir:: { AssocItemKind , HirIdSet , Node , PatKind } ;
1616use rustc_middle:: bug;
@@ -1174,15 +1174,17 @@ impl<'a, 'tcx> Visitor<'tcx> for NamePrivacyVisitor<'a, 'tcx> {
11741174struct TypePrivacyVisitor < ' a , ' tcx > {
11751175 tcx : TyCtxt < ' tcx > ,
11761176 tables : & ' a ty:: TypeckTables < ' tcx > ,
1177- current_item : DefId ,
1177+ current_item : LocalDefId ,
11781178 in_body : bool ,
11791179 span : Span ,
11801180 empty_tables : & ' a ty:: TypeckTables < ' tcx > ,
11811181}
11821182
11831183impl < ' a , ' tcx > TypePrivacyVisitor < ' a , ' tcx > {
11841184 fn item_is_accessible ( & self , did : DefId ) -> bool {
1185- def_id_visibility ( self . tcx , did) . 0 . is_accessible_from ( self . current_item , self . tcx )
1185+ def_id_visibility ( self . tcx , did)
1186+ . 0
1187+ . is_accessible_from ( self . current_item . to_def_id ( ) , self . tcx )
11861188 }
11871189
11881190 // Take node-id of an expression or pattern and check its type for privacy.
@@ -1387,10 +1389,8 @@ impl<'a, 'tcx> Visitor<'tcx> for TypePrivacyVisitor<'a, 'tcx> {
13871389
13881390 // Check types in item interfaces.
13891391 fn visit_item ( & mut self , item : & ' tcx hir:: Item < ' tcx > ) {
1390- let orig_current_item = mem:: replace (
1391- & mut self . current_item ,
1392- self . tcx . hir ( ) . local_def_id ( item. hir_id ) . to_def_id ( ) ,
1393- ) ;
1392+ let orig_current_item =
1393+ mem:: replace ( & mut self . current_item , self . tcx . hir ( ) . local_def_id ( item. hir_id ) ) ;
13941394 let orig_in_body = mem:: replace ( & mut self . in_body , false ) ;
13951395 let orig_tables =
13961396 mem:: replace ( & mut self . tables , item_tables ( self . tcx , item. hir_id , self . empty_tables ) ) ;
@@ -2076,7 +2076,7 @@ pub fn provide(providers: &mut Providers<'_>) {
20762076 } ;
20772077}
20782078
2079- fn check_mod_privacy ( tcx : TyCtxt < ' _ > , module_def_id : DefId ) {
2079+ fn check_mod_privacy ( tcx : TyCtxt < ' _ > , module_def_id : LocalDefId ) {
20802080 let empty_tables = ty:: TypeckTables :: empty ( None ) ;
20812081
20822082 // Check privacy of names not checked in previous compilation stages.
@@ -2086,7 +2086,7 @@ fn check_mod_privacy(tcx: TyCtxt<'_>, module_def_id: DefId) {
20862086 current_item : None ,
20872087 empty_tables : & empty_tables,
20882088 } ;
2089- let ( module, span, hir_id) = tcx. hir ( ) . get_module ( module_def_id. expect_local ( ) ) ;
2089+ let ( module, span, hir_id) = tcx. hir ( ) . get_module ( module_def_id) ;
20902090
20912091 intravisit:: walk_mod ( & mut visitor, module, hir_id) ;
20922092
0 commit comments