@@ -733,7 +733,7 @@ impl EncodeContext<'a, 'tcx> {
733
733
is_non_exhaustive : variant. is_field_list_non_exhaustive ( ) ,
734
734
} ;
735
735
736
- let enum_id = tcx. hir ( ) . as_local_hir_id ( def. did . expect_local ( ) ) ;
736
+ let enum_id = tcx. hir ( ) . local_def_id_to_hir_id ( def. did . expect_local ( ) ) ;
737
737
let enum_vis = & tcx. hir ( ) . expect_item ( enum_id) . vis ;
738
738
739
739
record ! ( self . tables. kind[ def_id] <- EntryKind :: Variant ( self . lazy( data) ) ) ;
@@ -780,7 +780,7 @@ impl EncodeContext<'a, 'tcx> {
780
780
781
781
// Variant constructors have the same visibility as the parent enums, unless marked as
782
782
// non-exhaustive, in which case they are lowered to `pub(crate)`.
783
- let enum_id = tcx. hir ( ) . as_local_hir_id ( def. did . expect_local ( ) ) ;
783
+ let enum_id = tcx. hir ( ) . local_def_id_to_hir_id ( def. did . expect_local ( ) ) ;
784
784
let enum_vis = & tcx. hir ( ) . expect_item ( enum_id) . vis ;
785
785
let mut ctor_vis = ty:: Visibility :: from_hir ( enum_vis, enum_id, tcx) ;
786
786
if variant. is_field_list_non_exhaustive ( ) && ctor_vis == ty:: Visibility :: Public {
@@ -819,11 +819,11 @@ impl EncodeContext<'a, 'tcx> {
819
819
let data = ModData {
820
820
reexports : match tcx. module_exports ( local_def_id) {
821
821
Some ( exports) => {
822
- let hir_map = self . tcx . hir ( ) ;
822
+ let hir = self . tcx . hir ( ) ;
823
823
self . lazy (
824
824
exports
825
825
. iter ( )
826
- . map ( |export| export. map_id ( |id| hir_map . as_local_hir_id ( id) ) ) ,
826
+ . map ( |export| export. map_id ( |id| hir . local_def_id_to_hir_id ( id) ) ) ,
827
827
)
828
828
}
829
829
_ => Lazy :: empty ( ) ,
@@ -855,7 +855,7 @@ impl EncodeContext<'a, 'tcx> {
855
855
let def_id = field. did ;
856
856
debug ! ( "EncodeContext::encode_field({:?})" , def_id) ;
857
857
858
- let variant_id = tcx. hir ( ) . as_local_hir_id ( variant. def_id . expect_local ( ) ) ;
858
+ let variant_id = tcx. hir ( ) . local_def_id_to_hir_id ( variant. def_id . expect_local ( ) ) ;
859
859
let variant_data = tcx. hir ( ) . expect_variant_data ( variant_id) ;
860
860
861
861
record ! ( self . tables. kind[ def_id] <- EntryKind :: Field ) ;
@@ -883,7 +883,7 @@ impl EncodeContext<'a, 'tcx> {
883
883
is_non_exhaustive : variant. is_field_list_non_exhaustive ( ) ,
884
884
} ;
885
885
886
- let struct_id = tcx. hir ( ) . as_local_hir_id ( adt_def. did . expect_local ( ) ) ;
886
+ let struct_id = tcx. hir ( ) . local_def_id_to_hir_id ( adt_def. did . expect_local ( ) ) ;
887
887
let struct_vis = & tcx. hir ( ) . expect_item ( struct_id) . vis ;
888
888
let mut ctor_vis = ty:: Visibility :: from_hir ( struct_vis, struct_id, tcx) ;
889
889
for field in & variant. fields {
@@ -945,7 +945,7 @@ impl EncodeContext<'a, 'tcx> {
945
945
debug ! ( "EncodeContext::encode_info_for_trait_item({:?})" , def_id) ;
946
946
let tcx = self . tcx ;
947
947
948
- let hir_id = tcx. hir ( ) . as_local_hir_id ( def_id. expect_local ( ) ) ;
948
+ let hir_id = tcx. hir ( ) . local_def_id_to_hir_id ( def_id. expect_local ( ) ) ;
949
949
let ast_item = tcx. hir ( ) . expect_trait_item ( hir_id) ;
950
950
let trait_item = tcx. associated_item ( def_id) ;
951
951
@@ -1034,7 +1034,7 @@ impl EncodeContext<'a, 'tcx> {
1034
1034
debug ! ( "EncodeContext::encode_info_for_impl_item({:?})" , def_id) ;
1035
1035
let tcx = self . tcx ;
1036
1036
1037
- let hir_id = self . tcx . hir ( ) . as_local_hir_id ( def_id. expect_local ( ) ) ;
1037
+ let hir_id = self . tcx . hir ( ) . local_def_id_to_hir_id ( def_id. expect_local ( ) ) ;
1038
1038
let ast_item = self . tcx . hir ( ) . expect_impl_item ( hir_id) ;
1039
1039
let impl_item = self . tcx . associated_item ( def_id) ;
1040
1040
@@ -1438,7 +1438,7 @@ impl EncodeContext<'a, 'tcx> {
1438
1438
1439
1439
// NOTE(eddyb) `tcx.type_of(def_id)` isn't used because it's fully generic,
1440
1440
// including on the signature, which is inferred in `typeck.
1441
- let hir_id = self . tcx . hir ( ) . as_local_hir_id ( def_id) ;
1441
+ let hir_id = self . tcx . hir ( ) . local_def_id_to_hir_id ( def_id) ;
1442
1442
let ty = self . tcx . typeck ( def_id) . node_type ( hir_id) ;
1443
1443
1444
1444
record ! ( self . tables. kind[ def_id. to_def_id( ) ] <- match ty. kind {
@@ -1465,7 +1465,7 @@ impl EncodeContext<'a, 'tcx> {
1465
1465
1466
1466
fn encode_info_for_anon_const ( & mut self , def_id : LocalDefId ) {
1467
1467
debug ! ( "EncodeContext::encode_info_for_anon_const({:?})" , def_id) ;
1468
- let id = self . tcx . hir ( ) . as_local_hir_id ( def_id) ;
1468
+ let id = self . tcx . hir ( ) . local_def_id_to_hir_id ( def_id) ;
1469
1469
let body_id = self . tcx . hir ( ) . body_owned_by ( id) ;
1470
1470
let const_data = self . encode_rendered_const_for_body ( body_id) ;
1471
1471
let qualifs = self . tcx . mir_const_qualif ( def_id) ;
0 commit comments