@@ -32,8 +32,8 @@ enum AnnotationKind {
32
32
Required ,
33
33
// Annotation is useless: reject it.
34
34
Prohibited ,
35
- // Annotation itself is useless, but it can be propagated to children.
36
- Container ,
35
+ // Annotation is optional. Stability can be propagated to children.
36
+ Optional ,
37
37
}
38
38
39
39
// A private tree-walker for producing an index.
@@ -77,7 +77,7 @@ impl<'a, 'tcx> Annotator<'a, 'tcx> {
77
77
if let Some ( mut stab) = stab {
78
78
// Error if prohibited, or can't inherit anything from a container.
79
79
if kind == AnnotationKind :: Prohibited
80
- || ( kind == AnnotationKind :: Container
80
+ || ( kind == AnnotationKind :: Optional
81
81
&& stab. level . is_stable ( )
82
82
&& stab. rustc_depr . is_none ( ) )
83
83
{
@@ -222,7 +222,7 @@ impl<'a, 'tcx> Visitor<'tcx> for Annotator<'a, 'tcx> {
222
222
// optional. They inherit stability from their parents when unannotated.
223
223
hir:: ItemKind :: Impl { of_trait : None , .. } | hir:: ItemKind :: ForeignMod ( ..) => {
224
224
self . in_trait_impl = false ;
225
- kind = AnnotationKind :: Container ;
225
+ kind = AnnotationKind :: Optional ;
226
226
}
227
227
hir:: ItemKind :: Impl { of_trait : Some ( _) , .. } => {
228
228
self . in_trait_impl = true ;
@@ -283,7 +283,7 @@ impl<'a, 'tcx> Visitor<'tcx> for Annotator<'a, 'tcx> {
283
283
let kind = match & p. kind {
284
284
// FIXME(const_generics:defaults)
285
285
hir:: GenericParamKind :: Type { default, .. } if default. is_some ( ) => {
286
- AnnotationKind :: Required
286
+ AnnotationKind :: Optional
287
287
}
288
288
_ => AnnotationKind :: Prohibited ,
289
289
} ;
@@ -363,16 +363,9 @@ impl<'a, 'tcx> Visitor<'tcx> for MissingStabilityAnnotations<'a, 'tcx> {
363
363
self . check_missing_stability ( md. hir_id , md. span , "macro" ) ;
364
364
}
365
365
366
- fn visit_generic_param ( & mut self , p : & ' tcx hir:: GenericParam < ' tcx > ) {
367
- match & p. kind {
368
- // FIXME(const_generics:defaults)
369
- hir:: GenericParamKind :: Type { default, .. } if default. is_some ( ) => {
370
- self . check_missing_stability ( p. hir_id , p. span , "default type parameter" ) ;
371
- }
372
- _ => { }
373
- }
374
- intravisit:: walk_generic_param ( self , p) ;
375
- }
366
+ // Note that we don't need to `check_missing_stability` for default generic parameters,
367
+ // as we assume that any default generic parameters without attributes are automatically
368
+ // stable (assuming they have not inherited instability from their parent).
376
369
}
377
370
378
371
fn new_index ( tcx : TyCtxt < ' tcx > ) -> Index < ' tcx > {
0 commit comments