@@ -6,8 +6,8 @@ use std::num::NonZero;
6
6
7
7
use rustc_ast_lowering:: stability:: extern_abi_stability;
8
8
use rustc_attr_data_structures:: {
9
- self as attrs, AttributeKind , ConstStability , DeprecatedSince , Stability , StabilityLevel ,
10
- StableSince , UnstableReason , VERSION_PLACEHOLDER , find_attr,
9
+ self as attrs, AttributeKind , ConstStability , DefaultBodyStability , DeprecatedSince , Stability ,
10
+ StabilityLevel , StableSince , UnstableReason , VERSION_PLACEHOLDER , find_attr,
11
11
} ;
12
12
use rustc_data_structures:: fx:: FxIndexMap ;
13
13
use rustc_data_structures:: unord:: { ExtendUnord , UnordMap , UnordSet } ;
@@ -150,6 +150,20 @@ fn lookup_deprecation_entry(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Option<Depre
150
150
Some ( DeprecationEntry :: local ( depr, def_id) )
151
151
}
152
152
153
+ #[ instrument( level = "debug" , skip( tcx) ) ]
154
+ fn lookup_default_body_stability (
155
+ tcx : TyCtxt < ' _ > ,
156
+ def_id : LocalDefId ,
157
+ ) -> Option < DefaultBodyStability > {
158
+ if !tcx. features ( ) . staged_api ( ) {
159
+ return None ;
160
+ }
161
+
162
+ let attrs = tcx. hir_attrs ( tcx. local_def_id_to_hir_id ( def_id) ) ;
163
+ // FIXME: check that this item can have body stability
164
+ attrs:: find_attr!( attrs, AttributeKind :: BodyStability { stability, .. } => * stability)
165
+ }
166
+
153
167
/// A private tree-walker for producing an `Index`.
154
168
struct Annotator < ' a , ' tcx > {
155
169
tcx : TyCtxt < ' tcx > ,
@@ -197,18 +211,9 @@ impl<'a, 'tcx> Annotator<'a, 'tcx> {
197
211
return ;
198
212
}
199
213
200
- // # Regular and body stability
214
+ // # Regular stability
201
215
let stab =
202
216
attrs:: find_attr!( attrs, AttributeKind :: Stability { stability, span: _ } => * stability) ;
203
- let body_stab =
204
- attrs:: find_attr!( attrs, AttributeKind :: BodyStability { stability, .. } => * stability) ;
205
-
206
- if let Some ( body_stab) = body_stab {
207
- // FIXME: check that this item can have body stability
208
-
209
- self . index . default_body_stab_map . insert ( def_id, body_stab) ;
210
- debug ! ( ?self . index. default_body_stab_map) ;
211
- }
212
217
213
218
if let Some ( stab) = stab {
214
219
debug ! ( "annotate: found {:?}" , stab) ;
@@ -702,7 +707,6 @@ fn stability_index(tcx: TyCtxt<'_>, (): ()) -> Index {
702
707
let mut index = Index {
703
708
stab_map : Default :: default ( ) ,
704
709
const_stab_map : Default :: default ( ) ,
705
- default_body_stab_map : Default :: default ( ) ,
706
710
implications : Default :: default ( ) ,
707
711
} ;
708
712
@@ -755,7 +759,7 @@ pub(crate) fn provide(providers: &mut Providers) {
755
759
stability_implications : |tcx, _| tcx. stability ( ) . implications . clone ( ) ,
756
760
lookup_stability : |tcx, id| tcx. stability ( ) . local_stability ( id) ,
757
761
lookup_const_stability : |tcx, id| tcx. stability ( ) . local_const_stability ( id) ,
758
- lookup_default_body_stability : |tcx , id| tcx . stability ( ) . local_default_body_stability ( id ) ,
762
+ lookup_default_body_stability,
759
763
lookup_deprecation_entry,
760
764
..* providers
761
765
} ;
0 commit comments