@@ -707,7 +707,7 @@ impl EncodeContext<'a, 'tcx> {
707
707
is_non_exhaustive : variant. is_field_list_non_exhaustive ( ) ,
708
708
} ;
709
709
710
- let enum_id = tcx. hir ( ) . as_local_hir_id ( def. did . expect_local ( ) ) ;
710
+ let enum_id = tcx. hir ( ) . local_def_id_to_hir_id ( def. did . expect_local ( ) ) ;
711
711
let enum_vis = & tcx. hir ( ) . expect_item ( enum_id) . vis ;
712
712
713
713
record ! ( self . tables. kind[ def_id] <- EntryKind :: Variant ( self . lazy( data) ) ) ;
@@ -754,7 +754,7 @@ impl EncodeContext<'a, 'tcx> {
754
754
755
755
// Variant constructors have the same visibility as the parent enums, unless marked as
756
756
// non-exhaustive, in which case they are lowered to `pub(crate)`.
757
- let enum_id = tcx. hir ( ) . as_local_hir_id ( def. did . expect_local ( ) ) ;
757
+ let enum_id = tcx. hir ( ) . local_def_id_to_hir_id ( def. did . expect_local ( ) ) ;
758
758
let enum_vis = & tcx. hir ( ) . expect_item ( enum_id) . vis ;
759
759
let mut ctor_vis = ty:: Visibility :: from_hir ( enum_vis, enum_id, tcx) ;
760
760
if variant. is_field_list_non_exhaustive ( ) && ctor_vis == ty:: Visibility :: Public {
@@ -793,11 +793,11 @@ impl EncodeContext<'a, 'tcx> {
793
793
let data = ModData {
794
794
reexports : match tcx. module_exports ( local_def_id) {
795
795
Some ( exports) => {
796
- let hir_map = self . tcx . hir ( ) ;
796
+ let hir = self . tcx . hir ( ) ;
797
797
self . lazy (
798
798
exports
799
799
. iter ( )
800
- . map ( |export| export. map_id ( |id| hir_map . as_local_hir_id ( id) ) ) ,
800
+ . map ( |export| export. map_id ( |id| hir . local_def_id_to_hir_id ( id) ) ) ,
801
801
)
802
802
}
803
803
_ => Lazy :: empty ( ) ,
@@ -829,7 +829,7 @@ impl EncodeContext<'a, 'tcx> {
829
829
let def_id = field. did ;
830
830
debug ! ( "EncodeContext::encode_field({:?})" , def_id) ;
831
831
832
- let variant_id = tcx. hir ( ) . as_local_hir_id ( variant. def_id . expect_local ( ) ) ;
832
+ let variant_id = tcx. hir ( ) . local_def_id_to_hir_id ( variant. def_id . expect_local ( ) ) ;
833
833
let variant_data = tcx. hir ( ) . expect_variant_data ( variant_id) ;
834
834
835
835
record ! ( self . tables. kind[ def_id] <- EntryKind :: Field ) ;
@@ -857,7 +857,7 @@ impl EncodeContext<'a, 'tcx> {
857
857
is_non_exhaustive : variant. is_field_list_non_exhaustive ( ) ,
858
858
} ;
859
859
860
- let struct_id = tcx. hir ( ) . as_local_hir_id ( adt_def. did . expect_local ( ) ) ;
860
+ let struct_id = tcx. hir ( ) . local_def_id_to_hir_id ( adt_def. did . expect_local ( ) ) ;
861
861
let struct_vis = & tcx. hir ( ) . expect_item ( struct_id) . vis ;
862
862
let mut ctor_vis = ty:: Visibility :: from_hir ( struct_vis, struct_id, tcx) ;
863
863
for field in & variant. fields {
@@ -919,7 +919,7 @@ impl EncodeContext<'a, 'tcx> {
919
919
debug ! ( "EncodeContext::encode_info_for_trait_item({:?})" , def_id) ;
920
920
let tcx = self . tcx ;
921
921
922
- let hir_id = tcx. hir ( ) . as_local_hir_id ( def_id. expect_local ( ) ) ;
922
+ let hir_id = tcx. hir ( ) . local_def_id_to_hir_id ( def_id. expect_local ( ) ) ;
923
923
let ast_item = tcx. hir ( ) . expect_trait_item ( hir_id) ;
924
924
let trait_item = tcx. associated_item ( def_id) ;
925
925
@@ -1008,7 +1008,7 @@ impl EncodeContext<'a, 'tcx> {
1008
1008
debug ! ( "EncodeContext::encode_info_for_impl_item({:?})" , def_id) ;
1009
1009
let tcx = self . tcx ;
1010
1010
1011
- let hir_id = self . tcx . hir ( ) . as_local_hir_id ( def_id. expect_local ( ) ) ;
1011
+ let hir_id = self . tcx . hir ( ) . local_def_id_to_hir_id ( def_id. expect_local ( ) ) ;
1012
1012
let ast_item = self . tcx . hir ( ) . expect_impl_item ( hir_id) ;
1013
1013
let impl_item = self . tcx . associated_item ( def_id) ;
1014
1014
@@ -1412,7 +1412,7 @@ impl EncodeContext<'a, 'tcx> {
1412
1412
1413
1413
// NOTE(eddyb) `tcx.type_of(def_id)` isn't used because it's fully generic,
1414
1414
// including on the signature, which is inferred in `typeck.
1415
- let hir_id = self . tcx . hir ( ) . as_local_hir_id ( def_id) ;
1415
+ let hir_id = self . tcx . hir ( ) . local_def_id_to_hir_id ( def_id) ;
1416
1416
let ty = self . tcx . typeck ( def_id) . node_type ( hir_id) ;
1417
1417
1418
1418
record ! ( self . tables. kind[ def_id. to_def_id( ) ] <- match ty. kind {
@@ -1439,7 +1439,7 @@ impl EncodeContext<'a, 'tcx> {
1439
1439
1440
1440
fn encode_info_for_anon_const ( & mut self , def_id : LocalDefId ) {
1441
1441
debug ! ( "EncodeContext::encode_info_for_anon_const({:?})" , def_id) ;
1442
- let id = self . tcx . hir ( ) . as_local_hir_id ( def_id) ;
1442
+ let id = self . tcx . hir ( ) . local_def_id_to_hir_id ( def_id) ;
1443
1443
let body_id = self . tcx . hir ( ) . body_owned_by ( id) ;
1444
1444
let const_data = self . encode_rendered_const_for_body ( body_id) ;
1445
1445
let qualifs = self . tcx . mir_const_qualif ( def_id) ;
0 commit comments