@@ -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:: Handler ;
@@ -1438,6 +1438,22 @@ impl HasAttrs for Stmt {
14381438 }
14391439}
14401440
1441+ impl HasAttrs for GenericParam {
1442+ fn attrs ( & self ) -> & [ ast:: Attribute ] {
1443+ match self {
1444+ GenericParam :: Lifetime ( lifetime) => lifetime. attrs ( ) ,
1445+ GenericParam :: Type ( ty) => ty. attrs ( ) ,
1446+ }
1447+ }
1448+
1449+ fn map_attrs < F : FnOnce ( Vec < Attribute > ) -> Vec < Attribute > > ( self , f : F ) -> Self {
1450+ match self {
1451+ GenericParam :: Lifetime ( lifetime) => GenericParam :: Lifetime ( lifetime. map_attrs ( f) ) ,
1452+ GenericParam :: Type ( ty) => GenericParam :: Type ( ty. map_attrs ( f) ) ,
1453+ }
1454+ }
1455+ }
1456+
14411457macro_rules! derive_has_attrs {
14421458 ( $( $ty: path) ,* ) => { $(
14431459 impl HasAttrs for $ty {
@@ -1457,5 +1473,5 @@ macro_rules! derive_has_attrs {
14571473
14581474derive_has_attrs ! {
14591475 Item , Expr , Local , ast:: ForeignItem , ast:: StructField , ast:: ImplItem , ast:: TraitItem , ast:: Arm ,
1460- ast:: Field , ast:: FieldPat , ast:: Variant_
1476+ ast:: Field , ast:: FieldPat , ast:: Variant_ , ast :: LifetimeDef , ast :: TyParam
14611477}
0 commit comments