@@ -9,7 +9,7 @@ use rustc_data_structures::fx::FxHashSet;
99use rustc_errors:: struct_span_err;
1010use rustc_hir as hir;
1111use rustc_hir:: def:: { DefKind , Res } ;
12- use rustc_hir:: def_id:: { CrateNum , DefId , CRATE_DEF_INDEX , LOCAL_CRATE } ;
12+ use rustc_hir:: def_id:: { CrateNum , DefId , LocalDefId , CRATE_DEF_INDEX , LOCAL_CRATE } ;
1313use rustc_hir:: intravisit:: { self , DeepVisitor , NestedVisitorMap , Visitor } ;
1414use rustc_hir:: { AssocItemKind , HirIdSet , Node , PatKind } ;
1515use rustc_middle:: bug;
@@ -1164,15 +1164,17 @@ impl<'a, 'tcx> Visitor<'tcx> for NamePrivacyVisitor<'a, 'tcx> {
11641164struct TypePrivacyVisitor < ' a , ' tcx > {
11651165 tcx : TyCtxt < ' tcx > ,
11661166 tables : & ' a ty:: TypeckTables < ' tcx > ,
1167- current_item : DefId ,
1167+ current_item : LocalDefId ,
11681168 in_body : bool ,
11691169 span : Span ,
11701170 empty_tables : & ' a ty:: TypeckTables < ' tcx > ,
11711171}
11721172
11731173impl < ' a , ' tcx > TypePrivacyVisitor < ' a , ' tcx > {
11741174 fn item_is_accessible ( & self , did : DefId ) -> bool {
1175- def_id_visibility ( self . tcx , did) . 0 . is_accessible_from ( self . current_item , self . tcx )
1175+ def_id_visibility ( self . tcx , did)
1176+ . 0
1177+ . is_accessible_from ( self . current_item . to_def_id ( ) , self . tcx )
11761178 }
11771179
11781180 // Take node-id of an expression or pattern and check its type for privacy.
@@ -1377,10 +1379,8 @@ impl<'a, 'tcx> Visitor<'tcx> for TypePrivacyVisitor<'a, 'tcx> {
13771379
13781380 // Check types in item interfaces.
13791381 fn visit_item ( & mut self , item : & ' tcx hir:: Item < ' tcx > ) {
1380- let orig_current_item = mem:: replace (
1381- & mut self . current_item ,
1382- self . tcx . hir ( ) . local_def_id ( item. hir_id ) . to_def_id ( ) ,
1383- ) ;
1382+ let orig_current_item =
1383+ mem:: replace ( & mut self . current_item , self . tcx . hir ( ) . local_def_id ( item. hir_id ) ) ;
13841384 let orig_in_body = mem:: replace ( & mut self . in_body , false ) ;
13851385 let orig_tables =
13861386 mem:: replace ( & mut self . tables , item_tables ( self . tcx , item. hir_id , self . empty_tables ) ) ;
@@ -2066,7 +2066,7 @@ pub fn provide(providers: &mut Providers<'_>) {
20662066 } ;
20672067}
20682068
2069- fn check_mod_privacy ( tcx : TyCtxt < ' _ > , module_def_id : DefId ) {
2069+ fn check_mod_privacy ( tcx : TyCtxt < ' _ > , module_def_id : LocalDefId ) {
20702070 let empty_tables = ty:: TypeckTables :: empty ( None ) ;
20712071
20722072 // Check privacy of names not checked in previous compilation stages.
@@ -2076,7 +2076,7 @@ fn check_mod_privacy(tcx: TyCtxt<'_>, module_def_id: DefId) {
20762076 current_item : None ,
20772077 empty_tables : & empty_tables,
20782078 } ;
2079- let ( module, span, hir_id) = tcx. hir ( ) . get_module ( module_def_id. expect_local ( ) ) ;
2079+ let ( module, span, hir_id) = tcx. hir ( ) . get_module ( module_def_id) ;
20802080
20812081 intravisit:: walk_mod ( & mut visitor, module, hir_id) ;
20822082
0 commit comments