@@ -119,7 +119,7 @@ pub fn def_to_string(did: DefId) -> String {
119
119
fn encode_item_variances ( rbml_w : & mut Encoder ,
120
120
ecx : & EncodeContext ,
121
121
id : NodeId ) {
122
- let v = ecx. tcx . item_variances ( DefId :: local ( id) ) ;
122
+ let v = ecx. tcx . item_variances ( ecx . tcx . map . local_def_id ( id) ) ;
123
123
rbml_w. start_tag ( tag_item_variances) ;
124
124
v. encode ( rbml_w) ;
125
125
rbml_w. end_tag ( ) ;
@@ -130,8 +130,8 @@ fn encode_bounds_and_type_for_item<'a, 'tcx>(rbml_w: &mut Encoder,
130
130
id : NodeId ) {
131
131
encode_bounds_and_type ( rbml_w,
132
132
ecx,
133
- & ecx. tcx . lookup_item_type ( DefId :: local ( id) ) ,
134
- & ecx. tcx . lookup_predicates ( DefId :: local ( id) ) ) ;
133
+ & ecx. tcx . lookup_item_type ( ecx . tcx . map . local_def_id ( id) ) ,
134
+ & ecx. tcx . lookup_predicates ( ecx . tcx . map . local_def_id ( id) ) ) ;
135
135
}
136
136
137
137
fn encode_bounds_and_type < ' a , ' tcx > ( rbml_w : & mut Encoder ,
@@ -278,7 +278,7 @@ fn encode_enum_variant_info(ecx: &EncodeContext,
278
278
debug ! ( "encode_enum_variant_info(id={})" , id) ;
279
279
280
280
let mut disr_val = 0 ;
281
- let def = ecx. tcx . lookup_adt_def ( DefId :: local ( id) ) ;
281
+ let def = ecx. tcx . lookup_adt_def ( ecx . tcx . map . local_def_id ( id) ) ;
282
282
for variant in & def. variants {
283
283
let vid = variant. did ;
284
284
assert ! ( vid. is_local( ) ) ;
@@ -302,7 +302,7 @@ fn encode_enum_variant_info(ecx: &EncodeContext,
302
302
ty:: VariantKind :: Dict => 'V'
303
303
} ) ;
304
304
encode_name ( rbml_w, variant. name ) ;
305
- encode_parent_item ( rbml_w, DefId :: local ( id) ) ;
305
+ encode_parent_item ( rbml_w, ecx . tcx . map . local_def_id ( id) ) ;
306
306
encode_visibility ( rbml_w, vis) ;
307
307
308
308
let attrs = ecx. tcx . get_attrs ( vid) ;
@@ -504,19 +504,19 @@ fn encode_info_for_mod(ecx: &EncodeContext,
504
504
name : Name ,
505
505
vis : hir:: Visibility ) {
506
506
rbml_w. start_tag ( tag_items_data_item) ;
507
- encode_def_id ( rbml_w, DefId :: local ( id) ) ;
507
+ encode_def_id ( rbml_w, ecx . tcx . map . local_def_id ( id) ) ;
508
508
encode_family ( rbml_w, 'm' ) ;
509
509
encode_name ( rbml_w, name) ;
510
510
debug ! ( "(encoding info for module) encoding info for module ID {}" , id) ;
511
511
512
512
// Encode info about all the module children.
513
513
for item in & md. items {
514
514
rbml_w. wr_tagged_u64 ( tag_mod_child,
515
- def_to_u64 ( DefId :: local ( item. id ) ) ) ;
515
+ def_to_u64 ( ecx . tcx . map . local_def_id ( item. id ) ) ) ;
516
516
517
517
each_auxiliary_node_id ( & * * item, |auxiliary_node_id| {
518
518
rbml_w. wr_tagged_u64 ( tag_mod_child,
519
- def_to_u64 ( DefId :: local ( auxiliary_node_id) ) ) ;
519
+ def_to_u64 ( ecx . tcx . map . local_def_id ( auxiliary_node_id) ) ) ;
520
520
true
521
521
} ) ;
522
522
@@ -526,14 +526,14 @@ fn encode_info_for_mod(ecx: &EncodeContext,
526
526
name,
527
527
did, ecx. tcx. map. node_to_string( did) ) ;
528
528
529
- rbml_w. wr_tagged_u64 ( tag_mod_impl, def_to_u64 ( DefId :: local ( did) ) ) ;
529
+ rbml_w. wr_tagged_u64 ( tag_mod_impl, def_to_u64 ( ecx . tcx . map . local_def_id ( did) ) ) ;
530
530
}
531
531
}
532
532
533
533
encode_path ( rbml_w, path. clone ( ) ) ;
534
534
encode_visibility ( rbml_w, vis) ;
535
535
536
- let stab = stability:: lookup ( ecx. tcx , DefId :: local ( id) ) ;
536
+ let stab = stability:: lookup ( ecx. tcx , ecx . tcx . map . local_def_id ( id) ) ;
537
537
encode_stability ( rbml_w, stab) ;
538
538
539
539
// Encode the reexports of this module, if this module is public.
@@ -627,7 +627,7 @@ fn encode_field<'a, 'tcx>(ecx: &EncodeContext<'a, 'tcx>,
627
627
encode_struct_field_family ( rbml_w, field. vis ) ;
628
628
encode_name ( rbml_w, nm) ;
629
629
encode_bounds_and_type_for_item ( rbml_w, ecx, id) ;
630
- encode_def_id ( rbml_w, DefId :: local ( id) ) ;
630
+ encode_def_id ( rbml_w, ecx . tcx . map . local_def_id ( id) ) ;
631
631
632
632
let stab = stability:: lookup ( ecx. tcx , field. did ) ;
633
633
encode_stability ( rbml_w, stab) ;
@@ -647,18 +647,18 @@ fn encode_info_for_struct_ctor(ecx: &EncodeContext,
647
647
} ) ;
648
648
649
649
rbml_w. start_tag ( tag_items_data_item) ;
650
- encode_def_id ( rbml_w, DefId :: local ( ctor_id) ) ;
650
+ encode_def_id ( rbml_w, ecx . tcx . map . local_def_id ( ctor_id) ) ;
651
651
encode_family ( rbml_w, 'o' ) ;
652
652
encode_bounds_and_type_for_item ( rbml_w, ecx, ctor_id) ;
653
653
encode_name ( rbml_w, name) ;
654
654
ecx. tcx . map . with_path ( ctor_id, |path| encode_path ( rbml_w, path) ) ;
655
- encode_parent_item ( rbml_w, DefId :: local ( struct_id) ) ;
655
+ encode_parent_item ( rbml_w, ecx . tcx . map . local_def_id ( struct_id) ) ;
656
656
657
657
if ecx. item_symbols . borrow ( ) . contains_key ( & ctor_id) {
658
658
encode_symbol ( ecx, rbml_w, ctor_id) ;
659
659
}
660
660
661
- let stab = stability:: lookup ( ecx. tcx , DefId :: local ( ctor_id) ) ;
661
+ let stab = stability:: lookup ( ecx. tcx , ecx . tcx . map . local_def_id ( ctor_id) ) ;
662
662
encode_stability ( rbml_w, stab) ;
663
663
664
664
// indicate that this is a tuple struct ctor, because downstream users will normally want
@@ -789,7 +789,7 @@ fn encode_info_for_associated_const(ecx: &EncodeContext,
789
789
encode_visibility ( rbml_w, associated_const. vis ) ;
790
790
encode_family ( rbml_w, 'C' ) ;
791
791
792
- encode_parent_item ( rbml_w, DefId :: local ( parent_id) ) ;
792
+ encode_parent_item ( rbml_w, ecx . tcx . map . local_def_id ( parent_id) ) ;
793
793
encode_item_sort ( rbml_w, 'C' ) ;
794
794
795
795
encode_bounds_and_type_for_item ( rbml_w, ecx, associated_const. def_id . local_id ( ) ) ;
@@ -802,7 +802,10 @@ fn encode_info_for_associated_const(ecx: &EncodeContext,
802
802
803
803
if let Some ( ii) = impl_item_opt {
804
804
encode_attributes ( rbml_w, & ii. attrs ) ;
805
- encode_inlined_item ( ecx, rbml_w, InlinedItemRef :: ImplItem ( DefId :: local ( parent_id) , ii) ) ;
805
+ encode_inlined_item ( ecx,
806
+ rbml_w,
807
+ InlinedItemRef :: ImplItem ( ecx. tcx . map . local_def_id ( parent_id) ,
808
+ ii) ) ;
806
809
}
807
810
808
811
rbml_w. end_tag ( ) ;
@@ -821,7 +824,7 @@ fn encode_info_for_method<'a, 'tcx>(ecx: &EncodeContext<'a, 'tcx>,
821
824
rbml_w. start_tag ( tag_items_data_item) ;
822
825
823
826
encode_method_ty_fields ( ecx, rbml_w, m) ;
824
- encode_parent_item ( rbml_w, DefId :: local ( parent_id) ) ;
827
+ encode_parent_item ( rbml_w, ecx . tcx . map . local_def_id ( parent_id) ) ;
825
828
encode_item_sort ( rbml_w, 'r' ) ;
826
829
827
830
let stab = stability:: lookup ( ecx. tcx , m. def_id ) ;
@@ -840,8 +843,10 @@ fn encode_info_for_method<'a, 'tcx>(ecx: &EncodeContext<'a, 'tcx>,
840
843
let needs_inline = any_types || is_default_impl ||
841
844
attr:: requests_inline ( & impl_item. attrs ) ;
842
845
if needs_inline || sig. constness == hir:: Constness :: Const {
843
- encode_inlined_item ( ecx, rbml_w, InlinedItemRef :: ImplItem ( DefId :: local ( parent_id) ,
844
- impl_item) ) ;
846
+ encode_inlined_item ( ecx,
847
+ rbml_w,
848
+ InlinedItemRef :: ImplItem ( ecx. tcx . map . local_def_id ( parent_id) ,
849
+ impl_item) ) ;
845
850
}
846
851
encode_constness ( rbml_w, sig. constness ) ;
847
852
if !any_types {
@@ -870,7 +875,7 @@ fn encode_info_for_associated_type<'a, 'tcx>(ecx: &EncodeContext<'a, 'tcx>,
870
875
encode_name ( rbml_w, associated_type. name ) ;
871
876
encode_visibility ( rbml_w, associated_type. vis ) ;
872
877
encode_family ( rbml_w, 'y' ) ;
873
- encode_parent_item ( rbml_w, DefId :: local ( parent_id) ) ;
878
+ encode_parent_item ( rbml_w, ecx . tcx . map . local_def_id ( parent_id) ) ;
874
879
encode_item_sort ( rbml_w, 't' ) ;
875
880
876
881
let stab = stability:: lookup ( ecx. tcx , associated_type. def_id ) ;
@@ -991,8 +996,8 @@ fn encode_info_for_item(ecx: &EncodeContext,
991
996
debug ! ( "encoding info for item at {}" ,
992
997
tcx. sess. codemap( ) . span_to_string( item. span) ) ;
993
998
994
- let def_id = DefId :: local ( item. id ) ;
995
- let stab = stability:: lookup ( tcx, DefId :: local ( item. id ) ) ;
999
+ let def_id = ecx . tcx . map . local_def_id ( item. id ) ;
1000
+ let stab = stability:: lookup ( tcx, ecx . tcx . map . local_def_id ( item. id ) ) ;
996
1001
997
1002
match item. node {
998
1003
hir:: ItemStatic ( _, m, _) => {
@@ -1072,7 +1077,7 @@ fn encode_info_for_item(ecx: &EncodeContext,
1072
1077
// Encode all the items in this module.
1073
1078
for foreign_item in & fm. items {
1074
1079
rbml_w. wr_tagged_u64 ( tag_mod_child,
1075
- def_to_u64 ( DefId :: local ( foreign_item. id ) ) ) ;
1080
+ def_to_u64 ( ecx . tcx . map . local_def_id ( foreign_item. id ) ) ) ;
1076
1081
}
1077
1082
encode_visibility ( rbml_w, vis) ;
1078
1083
encode_stability ( rbml_w, stab) ;
@@ -1102,7 +1107,7 @@ fn encode_info_for_item(ecx: &EncodeContext,
1102
1107
encode_attributes ( rbml_w, & item. attrs ) ;
1103
1108
encode_repr_attrs ( rbml_w, ecx, & item. attrs ) ;
1104
1109
for v in & enum_definition. variants {
1105
- encode_variant_id ( rbml_w, DefId :: local ( v. node . id ) ) ;
1110
+ encode_variant_id ( rbml_w, ecx . tcx . map . local_def_id ( v. node . id ) ) ;
1106
1111
}
1107
1112
encode_inlined_item ( ecx, rbml_w, InlinedItemRef :: Item ( item) ) ;
1108
1113
encode_path ( rbml_w, path) ;
@@ -1174,7 +1179,7 @@ fn encode_info_for_item(ecx: &EncodeContext,
1174
1179
encode_name ( rbml_w, item. name ) ;
1175
1180
encode_unsafety ( rbml_w, unsafety) ;
1176
1181
1177
- let trait_ref = tcx. impl_trait_ref ( DefId :: local ( item. id ) ) . unwrap ( ) ;
1182
+ let trait_ref = tcx. impl_trait_ref ( ecx . tcx . map . local_def_id ( item. id ) ) . unwrap ( ) ;
1178
1183
encode_trait_ref ( rbml_w, ecx, trait_ref, tag_item_trait_ref) ;
1179
1184
rbml_w. end_tag ( ) ;
1180
1185
}
@@ -1194,7 +1199,7 @@ fn encode_info_for_item(ecx: &EncodeContext,
1194
1199
encode_unsafety ( rbml_w, unsafety) ;
1195
1200
encode_polarity ( rbml_w, polarity) ;
1196
1201
1197
- match tcx. custom_coerce_unsized_kinds . borrow ( ) . get ( & DefId :: local ( item. id ) ) {
1202
+ match tcx. custom_coerce_unsized_kinds . borrow ( ) . get ( & ecx . tcx . map . local_def_id ( item. id ) ) {
1198
1203
Some ( & kind) => {
1199
1204
rbml_w. start_tag ( tag_impl_coerce_unsized_kind) ;
1200
1205
kind. encode ( rbml_w) ;
@@ -1228,7 +1233,7 @@ fn encode_info_for_item(ecx: &EncodeContext,
1228
1233
}
1229
1234
rbml_w. end_tag ( ) ;
1230
1235
}
1231
- if let Some ( trait_ref) = tcx. impl_trait_ref ( DefId :: local ( item. id ) ) {
1236
+ if let Some ( trait_ref) = tcx. impl_trait_ref ( ecx . tcx . map . local_def_id ( item. id ) ) {
1232
1237
encode_trait_ref ( rbml_w, ecx, trait_ref, tag_item_trait_ref) ;
1233
1238
}
1234
1239
encode_path ( rbml_w, path. clone ( ) ) ;
@@ -1472,7 +1477,7 @@ fn encode_info_for_foreign_item(ecx: &EncodeContext,
1472
1477
} ) ;
1473
1478
1474
1479
rbml_w. start_tag ( tag_items_data_item) ;
1475
- encode_def_id ( rbml_w, DefId :: local ( nitem. id ) ) ;
1480
+ encode_def_id ( rbml_w, ecx . tcx . map . local_def_id ( nitem. id ) ) ;
1476
1481
encode_visibility ( rbml_w, nitem. vis ) ;
1477
1482
match nitem. node {
1478
1483
hir:: ForeignItemFn ( ref fndecl, _) => {
@@ -1483,7 +1488,7 @@ fn encode_info_for_foreign_item(ecx: &EncodeContext,
1483
1488
encode_inlined_item ( ecx, rbml_w, InlinedItemRef :: Foreign ( nitem) ) ;
1484
1489
}
1485
1490
encode_attributes ( rbml_w, & * nitem. attrs ) ;
1486
- let stab = stability:: lookup ( ecx. tcx , DefId :: local ( nitem. id ) ) ;
1491
+ let stab = stability:: lookup ( ecx. tcx , ecx . tcx . map . local_def_id ( nitem. id ) ) ;
1487
1492
encode_stability ( rbml_w, stab) ;
1488
1493
encode_symbol ( ecx, rbml_w, nitem. id ) ;
1489
1494
encode_method_argument_names ( rbml_w, & * fndecl) ;
@@ -1496,7 +1501,7 @@ fn encode_info_for_foreign_item(ecx: &EncodeContext,
1496
1501
}
1497
1502
encode_bounds_and_type_for_item ( rbml_w, ecx, nitem. id ) ;
1498
1503
encode_attributes ( rbml_w, & * nitem. attrs ) ;
1499
- let stab = stability:: lookup ( ecx. tcx , DefId :: local ( nitem. id ) ) ;
1504
+ let stab = stability:: lookup ( ecx. tcx , ecx . tcx . map . local_def_id ( nitem. id ) ) ;
1500
1505
encode_stability ( rbml_w, stab) ;
1501
1506
encode_symbol ( ecx, rbml_w, nitem. id ) ;
1502
1507
encode_name ( rbml_w, nitem. name ) ;
@@ -1831,7 +1836,7 @@ impl<'a, 'b, 'c, 'tcx, 'v> Visitor<'v> for ImplVisitor<'a, 'b, 'c, 'tcx> {
1831
1836
if Some ( def_id) == self . ecx . tcx . lang_items . drop_trait ( ) ||
1832
1837
def_id. krate != LOCAL_CRATE {
1833
1838
self . rbml_w . start_tag ( tag_impls_impl) ;
1834
- encode_def_id ( self . rbml_w , DefId :: local ( item. id ) ) ;
1839
+ encode_def_id ( self . rbml_w , self . ecx . tcx . map . local_def_id ( item. id ) ) ;
1835
1840
self . rbml_w . wr_tagged_u64 ( tag_impls_impl_trait_def_id, def_to_u64 ( def_id) ) ;
1836
1841
self . rbml_w . end_tag ( ) ;
1837
1842
}
@@ -1873,11 +1878,11 @@ fn encode_misc_info(ecx: &EncodeContext,
1873
1878
rbml_w. start_tag ( tag_misc_info_crate_items) ;
1874
1879
for item in & krate. module . items {
1875
1880
rbml_w. wr_tagged_u64 ( tag_mod_child,
1876
- def_to_u64 ( DefId :: local ( item. id ) ) ) ;
1881
+ def_to_u64 ( ecx . tcx . map . local_def_id ( item. id ) ) ) ;
1877
1882
1878
1883
each_auxiliary_node_id ( & * * item, |auxiliary_node_id| {
1879
1884
rbml_w. wr_tagged_u64 ( tag_mod_child,
1880
- def_to_u64 ( DefId :: local ( auxiliary_node_id) ) ) ;
1885
+ def_to_u64 ( ecx . tcx . map . local_def_id ( auxiliary_node_id) ) ) ;
1881
1886
true
1882
1887
} ) ;
1883
1888
}
0 commit comments