@@ -32,8 +32,8 @@ enum AnnotationKind {
3232 Required ,
3333 // Annotation is useless: reject it.
3434 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 ,
3737}
3838
3939// A private tree-walker for producing an index.
@@ -77,7 +77,7 @@ impl<'a, 'tcx> Annotator<'a, 'tcx> {
7777 if let Some ( mut stab) = stab {
7878 // Error if prohibited, or can't inherit anything from a container.
7979 if kind == AnnotationKind :: Prohibited
80- || ( kind == AnnotationKind :: Container
80+ || ( kind == AnnotationKind :: Optional
8181 && stab. level . is_stable ( )
8282 && stab. rustc_depr . is_none ( ) )
8383 {
@@ -222,7 +222,7 @@ impl<'a, 'tcx> Visitor<'tcx> for Annotator<'a, 'tcx> {
222222 // optional. They inherit stability from their parents when unannotated.
223223 hir:: ItemKind :: Impl { of_trait : None , .. } | hir:: ItemKind :: ForeignMod ( ..) => {
224224 self . in_trait_impl = false ;
225- kind = AnnotationKind :: Container ;
225+ kind = AnnotationKind :: Optional ;
226226 }
227227 hir:: ItemKind :: Impl { of_trait : Some ( _) , .. } => {
228228 self . in_trait_impl = true ;
@@ -283,7 +283,7 @@ impl<'a, 'tcx> Visitor<'tcx> for Annotator<'a, 'tcx> {
283283 let kind = match & p. kind {
284284 // FIXME(const_generics:defaults)
285285 hir:: GenericParamKind :: Type { default, .. } if default. is_some ( ) => {
286- AnnotationKind :: Required
286+ AnnotationKind :: Optional
287287 }
288288 _ => AnnotationKind :: Prohibited ,
289289 } ;
@@ -363,16 +363,9 @@ impl<'a, 'tcx> Visitor<'tcx> for MissingStabilityAnnotations<'a, 'tcx> {
363363 self . check_missing_stability ( md. hir_id , md. span , "macro" ) ;
364364 }
365365
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).
376369}
377370
378371fn new_index ( tcx : TyCtxt < ' tcx > ) -> Index < ' tcx > {
0 commit comments