@@ -9,7 +9,7 @@ use rustc_data_structures::fx::FxHashSet;
9
9
use rustc_errors:: struct_span_err;
10
10
use rustc_hir as hir;
11
11
use 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 } ;
13
13
use rustc_hir:: intravisit:: { self , DeepVisitor , NestedVisitorMap , Visitor } ;
14
14
use rustc_hir:: { AssocItemKind , HirIdSet , Node , PatKind } ;
15
15
use rustc_middle:: bug;
@@ -1164,15 +1164,17 @@ impl<'a, 'tcx> Visitor<'tcx> for NamePrivacyVisitor<'a, 'tcx> {
1164
1164
struct TypePrivacyVisitor < ' a , ' tcx > {
1165
1165
tcx : TyCtxt < ' tcx > ,
1166
1166
tables : & ' a ty:: TypeckTables < ' tcx > ,
1167
- current_item : DefId ,
1167
+ current_item : LocalDefId ,
1168
1168
in_body : bool ,
1169
1169
span : Span ,
1170
1170
empty_tables : & ' a ty:: TypeckTables < ' tcx > ,
1171
1171
}
1172
1172
1173
1173
impl < ' a , ' tcx > TypePrivacyVisitor < ' a , ' tcx > {
1174
1174
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 )
1176
1178
}
1177
1179
1178
1180
// 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> {
1377
1379
1378
1380
// Check types in item interfaces.
1379
1381
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 ) ) ;
1384
1384
let orig_in_body = mem:: replace ( & mut self . in_body , false ) ;
1385
1385
let orig_tables =
1386
1386
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<'_>) {
2066
2066
} ;
2067
2067
}
2068
2068
2069
- fn check_mod_privacy ( tcx : TyCtxt < ' _ > , module_def_id : DefId ) {
2069
+ fn check_mod_privacy ( tcx : TyCtxt < ' _ > , module_def_id : LocalDefId ) {
2070
2070
let empty_tables = ty:: TypeckTables :: empty ( None ) ;
2071
2071
2072
2072
// Check privacy of names not checked in previous compilation stages.
@@ -2076,7 +2076,7 @@ fn check_mod_privacy(tcx: TyCtxt<'_>, module_def_id: DefId) {
2076
2076
current_item : None ,
2077
2077
empty_tables : & empty_tables,
2078
2078
} ;
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) ;
2080
2080
2081
2081
intravisit:: walk_mod ( & mut visitor, module, hir_id) ;
2082
2082
0 commit comments