@@ -342,8 +342,10 @@ fn encode_enum_variant_info<'a, 'tcx>(ecx: &EncodeContext<'a, 'tcx>,
342
342
encode_attributes ( rbml_w, & attrs) ;
343
343
encode_repr_attrs ( rbml_w, ecx, & attrs) ;
344
344
345
- let stab = stability:: lookup ( ecx. tcx , vid) ;
345
+ let stab = stability:: lookup_stability ( ecx. tcx , vid) ;
346
+ let depr = stability:: lookup_deprecation ( ecx. tcx , vid) ;
346
347
encode_stability ( rbml_w, stab) ;
348
+ encode_deprecation ( rbml_w, depr) ;
347
349
348
350
encode_struct_fields ( rbml_w, variant) ;
349
351
@@ -450,8 +452,10 @@ fn encode_info_for_mod(ecx: &EncodeContext,
450
452
encode_path ( rbml_w, path. clone ( ) ) ;
451
453
encode_visibility ( rbml_w, vis) ;
452
454
453
- let stab = stability:: lookup ( ecx. tcx , ecx. tcx . map . local_def_id ( id) ) ;
455
+ let stab = stability:: lookup_stability ( ecx. tcx , ecx. tcx . map . local_def_id ( id) ) ;
456
+ let depr = stability:: lookup_deprecation ( ecx. tcx , ecx. tcx . map . local_def_id ( id) ) ;
454
457
encode_stability ( rbml_w, stab) ;
458
+ encode_deprecation ( rbml_w, depr) ;
455
459
456
460
// Encode the reexports of this module, if this module is public.
457
461
if vis == hir:: Public {
@@ -538,8 +542,10 @@ fn encode_field<'a, 'tcx>(ecx: &EncodeContext<'a, 'tcx>,
538
542
encode_bounds_and_type_for_item ( rbml_w, ecx, index, id) ;
539
543
encode_def_id_and_key ( ecx, rbml_w, field. did ) ;
540
544
541
- let stab = stability:: lookup ( ecx. tcx , field. did ) ;
545
+ let stab = stability:: lookup_stability ( ecx. tcx , field. did ) ;
546
+ let depr = stability:: lookup_deprecation ( ecx. tcx , field. did ) ;
542
547
encode_stability ( rbml_w, stab) ;
548
+ encode_deprecation ( rbml_w, depr) ;
543
549
544
550
rbml_w. end_tag ( ) ;
545
551
}
@@ -565,8 +571,10 @@ fn encode_info_for_struct_ctor<'a, 'tcx>(ecx: &EncodeContext<'a, 'tcx>,
565
571
encode_symbol ( ecx, rbml_w, ctor_id) ;
566
572
}
567
573
568
- let stab = stability:: lookup ( ecx. tcx , ecx. tcx . map . local_def_id ( ctor_id) ) ;
574
+ let stab = stability:: lookup_stability ( ecx. tcx , ecx. tcx . map . local_def_id ( ctor_id) ) ;
575
+ let depr= stability:: lookup_deprecation ( ecx. tcx , ecx. tcx . map . local_def_id ( ctor_id) ) ;
569
576
encode_stability ( rbml_w, stab) ;
577
+ encode_deprecation ( rbml_w, depr) ;
570
578
571
579
// indicate that this is a tuple struct ctor, because downstream users will normally want
572
580
// the tuple struct definition, but without this there is no way for them to tell that
@@ -700,8 +708,10 @@ fn encode_info_for_associated_const<'a, 'tcx>(ecx: &EncodeContext<'a, 'tcx>,
700
708
encode_bounds_and_type_for_item ( rbml_w, ecx, index,
701
709
ecx. local_id ( associated_const. def_id ) ) ;
702
710
703
- let stab = stability:: lookup ( ecx. tcx , associated_const. def_id ) ;
711
+ let stab = stability:: lookup_stability ( ecx. tcx , associated_const. def_id ) ;
712
+ let depr = stability:: lookup_deprecation ( ecx. tcx , associated_const. def_id ) ;
704
713
encode_stability ( rbml_w, stab) ;
714
+ encode_deprecation ( rbml_w, depr) ;
705
715
706
716
let elem = ast_map:: PathName ( associated_const. name ) ;
707
717
encode_path ( rbml_w, impl_path. chain ( Some ( elem) ) ) ;
@@ -735,8 +745,10 @@ fn encode_info_for_method<'a, 'tcx>(ecx: &EncodeContext<'a, 'tcx>,
735
745
encode_parent_item ( rbml_w, ecx. tcx . map . local_def_id ( parent_id) ) ;
736
746
encode_item_sort ( rbml_w, 'r' ) ;
737
747
738
- let stab = stability:: lookup ( ecx. tcx , m. def_id ) ;
748
+ let stab = stability:: lookup_stability ( ecx. tcx , m. def_id ) ;
749
+ let depr = stability:: lookup_deprecation ( ecx. tcx , m. def_id ) ;
739
750
encode_stability ( rbml_w, stab) ;
751
+ encode_deprecation ( rbml_w, depr) ;
740
752
741
753
let m_node_id = ecx. local_id ( m. def_id ) ;
742
754
encode_bounds_and_type_for_item ( rbml_w, ecx, index, m_node_id) ;
@@ -789,8 +801,10 @@ fn encode_info_for_associated_type<'a, 'tcx>(ecx: &EncodeContext<'a, 'tcx>,
789
801
encode_parent_item ( rbml_w, ecx. tcx . map . local_def_id ( parent_id) ) ;
790
802
encode_item_sort ( rbml_w, 't' ) ;
791
803
792
- let stab = stability:: lookup ( ecx. tcx , associated_type. def_id ) ;
804
+ let stab = stability:: lookup_stability ( ecx. tcx , associated_type. def_id ) ;
805
+ let depr = stability:: lookup_deprecation ( ecx. tcx , associated_type. def_id ) ;
793
806
encode_stability ( rbml_w, stab) ;
807
+ encode_deprecation ( rbml_w, depr) ;
794
808
795
809
let elem = ast_map:: PathName ( associated_type. name ) ;
796
810
encode_path ( rbml_w, impl_path. chain ( Some ( elem) ) ) ;
@@ -891,6 +905,14 @@ fn encode_stability(rbml_w: &mut Encoder, stab_opt: Option<&attr::Stability>) {
891
905
} ) ;
892
906
}
893
907
908
+ fn encode_deprecation ( rbml_w : & mut Encoder , depr_opt : Option < attr:: Deprecation > ) {
909
+ depr_opt. map ( |depr| {
910
+ rbml_w. start_tag ( tag_items_data_item_deprecation) ;
911
+ depr. encode ( rbml_w) . unwrap ( ) ;
912
+ rbml_w. end_tag ( ) ;
913
+ } ) ;
914
+ }
915
+
894
916
fn encode_xrefs < ' a , ' tcx > ( ecx : & EncodeContext < ' a , ' tcx > ,
895
917
rbml_w : & mut Encoder ,
896
918
xrefs : FnvHashMap < XRef < ' tcx > , u32 > )
@@ -931,7 +953,8 @@ fn encode_info_for_item<'a, 'tcx>(ecx: &EncodeContext<'a, 'tcx>,
931
953
tcx. sess. codemap( ) . span_to_string( item. span) ) ;
932
954
933
955
let def_id = ecx. tcx . map . local_def_id ( item. id ) ;
934
- let stab = stability:: lookup ( tcx, ecx. tcx . map . local_def_id ( item. id ) ) ;
956
+ let stab = stability:: lookup_stability ( tcx, ecx. tcx . map . local_def_id ( item. id ) ) ;
957
+ let depr = stability:: lookup_deprecation ( tcx, ecx. tcx . map . local_def_id ( item. id ) ) ;
935
958
936
959
match item. node {
937
960
hir:: ItemStatic ( _, m, _) => {
@@ -949,6 +972,7 @@ fn encode_info_for_item<'a, 'tcx>(ecx: &EncodeContext<'a, 'tcx>,
949
972
encode_path ( rbml_w, path) ;
950
973
encode_visibility ( rbml_w, vis) ;
951
974
encode_stability ( rbml_w, stab) ;
975
+ encode_deprecation ( rbml_w, depr) ;
952
976
encode_attributes ( rbml_w, & item. attrs ) ;
953
977
rbml_w. end_tag ( ) ;
954
978
}
@@ -964,6 +988,7 @@ fn encode_info_for_item<'a, 'tcx>(ecx: &EncodeContext<'a, 'tcx>,
964
988
encode_inlined_item ( ecx, rbml_w, InlinedItemRef :: Item ( item) ) ;
965
989
encode_visibility ( rbml_w, vis) ;
966
990
encode_stability ( rbml_w, stab) ;
991
+ encode_deprecation ( rbml_w, depr) ;
967
992
rbml_w. end_tag ( ) ;
968
993
}
969
994
hir:: ItemFn ( ref decl, _, constness, _, ref generics, _) => {
@@ -986,6 +1011,7 @@ fn encode_info_for_item<'a, 'tcx>(ecx: &EncodeContext<'a, 'tcx>,
986
1011
encode_constness ( rbml_w, constness) ;
987
1012
encode_visibility ( rbml_w, vis) ;
988
1013
encode_stability ( rbml_w, stab) ;
1014
+ encode_deprecation ( rbml_w, depr) ;
989
1015
encode_method_argument_names ( rbml_w, & * * decl) ;
990
1016
rbml_w. end_tag ( ) ;
991
1017
}
@@ -1015,6 +1041,7 @@ fn encode_info_for_item<'a, 'tcx>(ecx: &EncodeContext<'a, 'tcx>,
1015
1041
}
1016
1042
encode_visibility ( rbml_w, vis) ;
1017
1043
encode_stability ( rbml_w, stab) ;
1044
+ encode_deprecation ( rbml_w, depr) ;
1018
1045
rbml_w. end_tag ( ) ;
1019
1046
}
1020
1047
hir:: ItemTy ( ..) => {
@@ -1027,6 +1054,7 @@ fn encode_info_for_item<'a, 'tcx>(ecx: &EncodeContext<'a, 'tcx>,
1027
1054
encode_path ( rbml_w, path) ;
1028
1055
encode_visibility ( rbml_w, vis) ;
1029
1056
encode_stability ( rbml_w, stab) ;
1057
+ encode_deprecation ( rbml_w, depr) ;
1030
1058
rbml_w. end_tag ( ) ;
1031
1059
}
1032
1060
hir:: ItemEnum ( ref enum_definition, _) => {
@@ -1051,6 +1079,7 @@ fn encode_info_for_item<'a, 'tcx>(ecx: &EncodeContext<'a, 'tcx>,
1051
1079
1052
1080
encode_visibility ( rbml_w, vis) ;
1053
1081
encode_stability ( rbml_w, stab) ;
1082
+ encode_deprecation ( rbml_w, depr) ;
1054
1083
rbml_w. end_tag ( ) ;
1055
1084
1056
1085
encode_enum_variant_info ( ecx,
@@ -1077,6 +1106,7 @@ fn encode_info_for_item<'a, 'tcx>(ecx: &EncodeContext<'a, 'tcx>,
1077
1106
encode_attributes ( rbml_w, & item. attrs ) ;
1078
1107
encode_path ( rbml_w, path. clone ( ) ) ;
1079
1108
encode_stability ( rbml_w, stab) ;
1109
+ encode_deprecation ( rbml_w, depr) ;
1080
1110
encode_visibility ( rbml_w, vis) ;
1081
1111
encode_repr_attrs ( rbml_w, ecx, & item. attrs ) ;
1082
1112
@@ -1167,6 +1197,7 @@ fn encode_info_for_item<'a, 'tcx>(ecx: &EncodeContext<'a, 'tcx>,
1167
1197
}
1168
1198
encode_path ( rbml_w, path. clone ( ) ) ;
1169
1199
encode_stability ( rbml_w, stab) ;
1200
+ encode_deprecation ( rbml_w, depr) ;
1170
1201
rbml_w. end_tag ( ) ;
1171
1202
1172
1203
// Iterate down the trait items, emitting them. We rely on the
@@ -1236,6 +1267,7 @@ fn encode_info_for_item<'a, 'tcx>(ecx: &EncodeContext<'a, 'tcx>,
1236
1267
encode_attributes ( rbml_w, & item. attrs ) ;
1237
1268
encode_visibility ( rbml_w, vis) ;
1238
1269
encode_stability ( rbml_w, stab) ;
1270
+ encode_deprecation ( rbml_w, depr) ;
1239
1271
for & method_def_id in tcx. trait_item_def_ids ( def_id) . iter ( ) {
1240
1272
rbml_w. start_tag ( tag_item_trait_item) ;
1241
1273
match method_def_id {
@@ -1274,8 +1306,10 @@ fn encode_info_for_item<'a, 'tcx>(ecx: &EncodeContext<'a, 'tcx>,
1274
1306
1275
1307
encode_parent_item ( rbml_w, def_id) ;
1276
1308
1277
- let stab = stability:: lookup ( tcx, item_def_id. def_id ( ) ) ;
1309
+ let stab = stability:: lookup_stability ( tcx, item_def_id. def_id ( ) ) ;
1310
+ let depr = stability:: lookup_deprecation ( tcx, item_def_id. def_id ( ) ) ;
1278
1311
encode_stability ( rbml_w, stab) ;
1312
+ encode_deprecation ( rbml_w, depr) ;
1279
1313
1280
1314
let trait_item_type =
1281
1315
tcx. impl_or_trait_item ( item_def_id. def_id ( ) ) ;
@@ -1407,8 +1441,10 @@ fn encode_info_for_foreign_item<'a, 'tcx>(ecx: &EncodeContext<'a, 'tcx>,
1407
1441
encode_inlined_item ( ecx, rbml_w, InlinedItemRef :: Foreign ( nitem) ) ;
1408
1442
}
1409
1443
encode_attributes ( rbml_w, & * nitem. attrs ) ;
1410
- let stab = stability:: lookup ( ecx. tcx , ecx. tcx . map . local_def_id ( nitem. id ) ) ;
1444
+ let stab = stability:: lookup_stability ( ecx. tcx , ecx. tcx . map . local_def_id ( nitem. id ) ) ;
1445
+ let depr = stability:: lookup_deprecation ( ecx. tcx , ecx. tcx . map . local_def_id ( nitem. id ) ) ;
1411
1446
encode_stability ( rbml_w, stab) ;
1447
+ encode_deprecation ( rbml_w, depr) ;
1412
1448
encode_symbol ( ecx, rbml_w, nitem. id ) ;
1413
1449
encode_method_argument_names ( rbml_w, & * fndecl) ;
1414
1450
}
@@ -1420,8 +1456,10 @@ fn encode_info_for_foreign_item<'a, 'tcx>(ecx: &EncodeContext<'a, 'tcx>,
1420
1456
}
1421
1457
encode_bounds_and_type_for_item ( rbml_w, ecx, index, nitem. id ) ;
1422
1458
encode_attributes ( rbml_w, & * nitem. attrs ) ;
1423
- let stab = stability:: lookup ( ecx. tcx , ecx. tcx . map . local_def_id ( nitem. id ) ) ;
1459
+ let stab = stability:: lookup_stability ( ecx. tcx , ecx. tcx . map . local_def_id ( nitem. id ) ) ;
1460
+ let depr = stability:: lookup_deprecation ( ecx. tcx , ecx. tcx . map . local_def_id ( nitem. id ) ) ;
1424
1461
encode_stability ( rbml_w, stab) ;
1462
+ encode_deprecation ( rbml_w, depr) ;
1425
1463
encode_symbol ( ecx, rbml_w, nitem. id ) ;
1426
1464
encode_name ( rbml_w, nitem. name ) ;
1427
1465
}
0 commit comments