@@ -17,7 +17,7 @@ pub use self::IntType::*;
1717use ast;
1818use ast:: { AttrId , Attribute , Name , Ident , Path , PathSegment } ;
1919use ast:: { MetaItem , MetaItemKind , NestedMetaItem , NestedMetaItemKind } ;
20- use ast:: { Lit , LitKind , Expr , ExprKind , Item , Local , Stmt , StmtKind } ;
20+ use ast:: { Lit , LitKind , Expr , ExprKind , Item , Local , Stmt , StmtKind , GenericParam } ;
2121use codemap:: { BytePos , Spanned , respan, dummy_spanned} ;
2222use syntax_pos:: Span ;
2323use errors:: { Applicability , Handler } ;
@@ -1444,6 +1444,22 @@ impl HasAttrs for Stmt {
14441444 }
14451445}
14461446
1447+ impl HasAttrs for GenericParam {
1448+ fn attrs ( & self ) -> & [ ast:: Attribute ] {
1449+ match self {
1450+ GenericParam :: Lifetime ( lifetime) => lifetime. attrs ( ) ,
1451+ GenericParam :: Type ( ty) => ty. attrs ( ) ,
1452+ }
1453+ }
1454+
1455+ fn map_attrs < F : FnOnce ( Vec < Attribute > ) -> Vec < Attribute > > ( self , f : F ) -> Self {
1456+ match self {
1457+ GenericParam :: Lifetime ( lifetime) => GenericParam :: Lifetime ( lifetime. map_attrs ( f) ) ,
1458+ GenericParam :: Type ( ty) => GenericParam :: Type ( ty. map_attrs ( f) ) ,
1459+ }
1460+ }
1461+ }
1462+
14471463macro_rules! derive_has_attrs {
14481464 ( $( $ty: path) ,* ) => { $(
14491465 impl HasAttrs for $ty {
@@ -1463,5 +1479,5 @@ macro_rules! derive_has_attrs {
14631479
14641480derive_has_attrs ! {
14651481 Item , Expr , Local , ast:: ForeignItem , ast:: StructField , ast:: ImplItem , ast:: TraitItem , ast:: Arm ,
1466- ast:: Field , ast:: FieldPat , ast:: Variant_
1482+ ast:: Field , ast:: FieldPat , ast:: Variant_ , ast :: LifetimeDef , ast :: TyParam
14671483}
0 commit comments