22//! propagating default levels lexically from parent to children ast nodes.
33
44use rustc_attr:: {
5- self as attr, ConstStability , DefaultBodyStability , Stability , StabilityLevel , Unstable ,
6- UnstableReason ,
5+ self as attr, ConstStability , Stability , StabilityLevel , Unstable , UnstableReason ,
76} ;
87use rustc_data_structures:: fx:: { FxHashMap , FxHashSet , FxIndexMap } ;
98use rustc_errors:: { struct_span_err, Applicability } ;
@@ -91,7 +90,6 @@ struct Annotator<'a, 'tcx> {
9190 index : & ' a mut Index ,
9291 parent_stab : Option < Stability > ,
9392 parent_const_stab : Option < ConstStability > ,
94- parent_body_stab : Option < DefaultBodyStability > ,
9593 parent_depr : Option < DeprecationEntry > ,
9694 in_trait_impl : bool ,
9795}
@@ -159,7 +157,6 @@ impl<'a, 'tcx> Annotator<'a, 'tcx> {
159157 depr. map ( |( d, _) | DeprecationEntry :: local ( d, def_id) ) ,
160158 None ,
161159 None ,
162- None ,
163160 visit_children,
164161 ) ;
165162 return ;
@@ -213,14 +210,12 @@ impl<'a, 'tcx> Annotator<'a, 'tcx> {
213210 }
214211 }
215212
216- let body_stab = body_stab . map ( | ( body_stab, _span) | {
213+ if let Some ( ( body_stab, _span) ) = body_stab {
217214 // FIXME: check that this item can have body stability
218215
219216 self . index . default_body_stab_map . insert ( def_id, body_stab) ;
220217 debug ! ( ?self . index. default_body_stab_map) ;
221-
222- body_stab
223- } ) ;
218+ }
224219
225220 let stab = stab. map ( |( stab, span) | {
226221 // Error if prohibited, or can't inherit anything from a container.
@@ -299,7 +294,6 @@ impl<'a, 'tcx> Annotator<'a, 'tcx> {
299294 depr. map ( |( d, _) | DeprecationEntry :: local ( d, def_id) ) ,
300295 stab,
301296 if inherit_const_stability. yes ( ) { const_stab } else { None } ,
302- body_stab,
303297 visit_children,
304298 ) ;
305299 }
@@ -309,14 +303,12 @@ impl<'a, 'tcx> Annotator<'a, 'tcx> {
309303 depr : Option < DeprecationEntry > ,
310304 stab : Option < Stability > ,
311305 const_stab : Option < ConstStability > ,
312- body_stab : Option < DefaultBodyStability > ,
313306 f : impl FnOnce ( & mut Self ) ,
314307 ) {
315308 // These will be `Some` if this item changes the corresponding stability attribute.
316309 let mut replaced_parent_depr = None ;
317310 let mut replaced_parent_stab = None ;
318311 let mut replaced_parent_const_stab = None ;
319- let mut replaced_parent_body_stab = None ;
320312
321313 if let Some ( depr) = depr {
322314 replaced_parent_depr = Some ( replace ( & mut self . parent_depr , Some ( depr) ) ) ;
@@ -328,9 +320,6 @@ impl<'a, 'tcx> Annotator<'a, 'tcx> {
328320 replaced_parent_const_stab =
329321 Some ( replace ( & mut self . parent_const_stab , Some ( const_stab) ) ) ;
330322 }
331- if let Some ( body_stab) = body_stab {
332- replaced_parent_body_stab = Some ( self . parent_body_stab . replace ( body_stab) ) ;
333- }
334323
335324 f ( self ) ;
336325
@@ -343,9 +332,6 @@ impl<'a, 'tcx> Annotator<'a, 'tcx> {
343332 if let Some ( orig_parent_const_stab) = replaced_parent_const_stab {
344333 self . parent_const_stab = orig_parent_const_stab;
345334 }
346- if let Some ( orig_parent_body_stab) = replaced_parent_body_stab {
347- self . parent_body_stab = orig_parent_body_stab;
348- }
349335 }
350336}
351337
@@ -646,7 +632,6 @@ fn stability_index(tcx: TyCtxt<'_>, (): ()) -> Index {
646632 index : & mut index,
647633 parent_stab : None ,
648634 parent_const_stab : None ,
649- parent_body_stab : None ,
650635 parent_depr : None ,
651636 in_trait_impl : false ,
652637 } ;
0 commit comments