@@ -569,15 +569,15 @@ struct MissingStabilityAnnotations<'tcx> {
569
569
570
570
impl < ' tcx > MissingStabilityAnnotations < ' tcx > {
571
571
fn check_missing_stability ( & self , def_id : LocalDefId , span : Span ) {
572
- let stab = self . tcx . stability ( ) . local_stability ( def_id) ;
572
+ let stab = self . tcx . stability_index ( ( ) ) . local_stability ( def_id) ;
573
573
if !self . tcx . sess . opts . test && stab. is_none ( ) && self . access_levels . is_reachable ( def_id) {
574
574
let descr = self . tcx . def_kind ( def_id) . descr ( def_id. to_def_id ( ) ) ;
575
575
self . tcx . sess . span_err ( span, & format ! ( "{} has missing stability attribute" , descr) ) ;
576
576
}
577
577
}
578
578
579
579
fn check_missing_const_stability ( & self , def_id : LocalDefId , span : Span ) {
580
- let stab_map = self . tcx . stability ( ) ;
580
+ let stab_map = self . tcx . stability_index ( ( ) ) ;
581
581
let stab = stab_map. local_stability ( def_id) ;
582
582
if stab. map_or ( false , |stab| stab. level . is_stable ( ) ) {
583
583
let const_stab = stab_map. local_const_stability ( def_id) ;
@@ -730,7 +730,18 @@ fn check_mod_unstable_api_usage(tcx: TyCtxt<'_>, module_def_id: LocalDefId) {
730
730
}
731
731
732
732
pub ( crate ) fn provide ( providers : & mut Providers ) {
733
- * providers = Providers { check_mod_unstable_api_usage, stability_index, ..* providers } ;
733
+ * providers = Providers {
734
+ check_mod_unstable_api_usage,
735
+ stability_index,
736
+ lookup_stability : |tcx, id| tcx. stability_index ( ( ) ) . local_stability ( id. expect_local ( ) ) ,
737
+ lookup_const_stability : |tcx, id| {
738
+ tcx. stability_index ( ( ) ) . local_const_stability ( id. expect_local ( ) )
739
+ } ,
740
+ lookup_deprecation_entry : |tcx, id| {
741
+ tcx. stability_index ( ( ) ) . local_deprecation_entry ( id. expect_local ( ) )
742
+ } ,
743
+ ..* providers
744
+ } ;
734
745
}
735
746
736
747
struct Checker < ' tcx > {
@@ -905,7 +916,7 @@ impl Visitor<'tcx> for CheckTraitImplStable<'tcx> {
905
916
pub fn check_unused_or_stable_features ( tcx : TyCtxt < ' _ > ) {
906
917
let access_levels = & tcx. privacy_access_levels ( ( ) ) ;
907
918
908
- if tcx. stability ( ) . staged_api [ & LOCAL_CRATE ] {
919
+ if tcx. stability_index ( ( ) ) . staged_api [ & LOCAL_CRATE ] {
909
920
let mut missing = MissingStabilityAnnotations { tcx, access_levels } ;
910
921
missing. check_missing_stability ( CRATE_DEF_ID , tcx. hir ( ) . span ( CRATE_HIR_ID ) ) ;
911
922
tcx. hir ( ) . walk_toplevel_module ( & mut missing) ;
0 commit comments