2
2
//! propagating default levels lexically from parent to children ast nodes.
3
3
4
4
use rustc_attr:: {
5
- self as attr, ConstStability , DefaultBodyStability , Stability , StabilityLevel , Unstable ,
6
- UnstableReason ,
5
+ self as attr, ConstStability , Stability , StabilityLevel , Unstable , UnstableReason ,
7
6
} ;
8
7
use rustc_data_structures:: fx:: { FxHashMap , FxHashSet , FxIndexMap } ;
9
8
use rustc_errors:: { struct_span_err, Applicability } ;
@@ -91,7 +90,6 @@ struct Annotator<'a, 'tcx> {
91
90
index : & ' a mut Index ,
92
91
parent_stab : Option < Stability > ,
93
92
parent_const_stab : Option < ConstStability > ,
94
- parent_body_stab : Option < DefaultBodyStability > ,
95
93
parent_depr : Option < DeprecationEntry > ,
96
94
in_trait_impl : bool ,
97
95
}
@@ -159,7 +157,6 @@ impl<'a, 'tcx> Annotator<'a, 'tcx> {
159
157
depr. map ( |( d, _) | DeprecationEntry :: local ( d, def_id) ) ,
160
158
None ,
161
159
None ,
162
- None ,
163
160
visit_children,
164
161
) ;
165
162
return ;
@@ -213,14 +210,12 @@ impl<'a, 'tcx> Annotator<'a, 'tcx> {
213
210
}
214
211
}
215
212
216
- let body_stab = body_stab . map ( | ( body_stab, _span) | {
213
+ if let Some ( ( body_stab, _span) ) = body_stab {
217
214
// FIXME: check that this item can have body stability
218
215
219
216
self . index . default_body_stab_map . insert ( def_id, body_stab) ;
220
217
debug ! ( ?self . index. default_body_stab_map) ;
221
-
222
- body_stab
223
- } ) ;
218
+ }
224
219
225
220
let stab = stab. map ( |( stab, span) | {
226
221
// Error if prohibited, or can't inherit anything from a container.
@@ -299,7 +294,6 @@ impl<'a, 'tcx> Annotator<'a, 'tcx> {
299
294
depr. map ( |( d, _) | DeprecationEntry :: local ( d, def_id) ) ,
300
295
stab,
301
296
if inherit_const_stability. yes ( ) { const_stab } else { None } ,
302
- body_stab,
303
297
visit_children,
304
298
) ;
305
299
}
@@ -309,14 +303,12 @@ impl<'a, 'tcx> Annotator<'a, 'tcx> {
309
303
depr : Option < DeprecationEntry > ,
310
304
stab : Option < Stability > ,
311
305
const_stab : Option < ConstStability > ,
312
- body_stab : Option < DefaultBodyStability > ,
313
306
f : impl FnOnce ( & mut Self ) ,
314
307
) {
315
308
// These will be `Some` if this item changes the corresponding stability attribute.
316
309
let mut replaced_parent_depr = None ;
317
310
let mut replaced_parent_stab = None ;
318
311
let mut replaced_parent_const_stab = None ;
319
- let mut replaced_parent_body_stab = None ;
320
312
321
313
if let Some ( depr) = depr {
322
314
replaced_parent_depr = Some ( replace ( & mut self . parent_depr , Some ( depr) ) ) ;
@@ -328,9 +320,6 @@ impl<'a, 'tcx> Annotator<'a, 'tcx> {
328
320
replaced_parent_const_stab =
329
321
Some ( replace ( & mut self . parent_const_stab , Some ( const_stab) ) ) ;
330
322
}
331
- if let Some ( body_stab) = body_stab {
332
- replaced_parent_body_stab = Some ( self . parent_body_stab . replace ( body_stab) ) ;
333
- }
334
323
335
324
f ( self ) ;
336
325
@@ -343,9 +332,6 @@ impl<'a, 'tcx> Annotator<'a, 'tcx> {
343
332
if let Some ( orig_parent_const_stab) = replaced_parent_const_stab {
344
333
self . parent_const_stab = orig_parent_const_stab;
345
334
}
346
- if let Some ( orig_parent_body_stab) = replaced_parent_body_stab {
347
- self . parent_body_stab = orig_parent_body_stab;
348
- }
349
335
}
350
336
}
351
337
@@ -646,7 +632,6 @@ fn stability_index(tcx: TyCtxt<'_>, (): ()) -> Index {
646
632
index : & mut index,
647
633
parent_stab : None ,
648
634
parent_const_stab : None ,
649
- parent_body_stab : None ,
650
635
parent_depr : None ,
651
636
in_trait_impl : false ,
652
637
} ;
0 commit comments