@@ -1280,10 +1280,10 @@ impl<'a> Parser<'a> {
12801280 mut attrs : Vec < Attribute > ) -> PResult < ' a , TraitItem > {
12811281 let lo = self . span ;
12821282
1283- let ( name, node) = if self . eat_keyword ( keywords:: Type ) {
1283+ let ( name, node, generics ) = if self . eat_keyword ( keywords:: Type ) {
12841284 let TyParam { ident, bounds, default, ..} = self . parse_ty_param ( vec ! [ ] ) ?;
12851285 self . expect ( & token:: Semi ) ?;
1286- ( ident, TraitItemKind :: Type ( bounds, default) )
1286+ ( ident, TraitItemKind :: Type ( bounds, default) , ast :: Generics :: default ( ) )
12871287 } else if self . is_const_item ( ) {
12881288 self . expect_keyword ( keywords:: Const ) ?;
12891289 let ident = self . parse_ident ( ) ?;
@@ -1298,7 +1298,7 @@ impl<'a> Parser<'a> {
12981298 self . expect ( & token:: Semi ) ?;
12991299 None
13001300 } ;
1301- ( ident, TraitItemKind :: Const ( ty, default) )
1301+ ( ident, TraitItemKind :: Const ( ty, default) , ast :: Generics :: default ( ) )
13021302 } else if self . token . is_path_start ( ) {
13031303 // trait item macro.
13041304 // code copied from parse_macro_use_or_failure... abstraction!
@@ -1321,7 +1321,7 @@ impl<'a> Parser<'a> {
13211321 }
13221322
13231323 let mac = respan ( lo. to ( self . prev_span ) , Mac_ { path : pth, tts : tts } ) ;
1324- ( keywords:: Invalid . ident ( ) , ast:: TraitItemKind :: Macro ( mac) )
1324+ ( keywords:: Invalid . ident ( ) , ast:: TraitItemKind :: Macro ( mac) , ast :: Generics :: default ( ) )
13251325 } else {
13261326 let ( constness, unsafety, abi) = self . parse_fn_front_matter ( ) ?;
13271327
@@ -1334,13 +1334,12 @@ impl<'a> Parser<'a> {
13341334 // definition...
13351335 p. parse_arg_general ( false )
13361336 } ) ?;
1337-
13381337 generics. where_clause = self . parse_where_clause ( ) ?;
1338+
13391339 let sig = ast:: MethodSig {
13401340 unsafety,
13411341 constness,
13421342 decl : d,
1343- generics,
13441343 abi,
13451344 } ;
13461345
@@ -1363,13 +1362,14 @@ impl<'a> Parser<'a> {
13631362 return Err ( self . fatal ( & format ! ( "expected `;` or `{{`, found `{}`" , token_str) ) ) ;
13641363 }
13651364 } ;
1366- ( ident, ast:: TraitItemKind :: Method ( sig, body) )
1365+ ( ident, ast:: TraitItemKind :: Method ( sig, body) , generics )
13671366 } ;
13681367
13691368 Ok ( TraitItem {
13701369 id : ast:: DUMMY_NODE_ID ,
13711370 ident : name,
13721371 attrs,
1372+ generics,
13731373 node,
13741374 span : lo. to ( self . prev_span ) ,
13751375 tokens : None ,
@@ -4834,12 +4834,12 @@ impl<'a> Parser<'a> {
48344834 let lo = self . span ;
48354835 let vis = self . parse_visibility ( false ) ?;
48364836 let defaultness = self . parse_defaultness ( ) ?;
4837- let ( name, node) = if self . eat_keyword ( keywords:: Type ) {
4837+ let ( name, node, generics ) = if self . eat_keyword ( keywords:: Type ) {
48384838 let name = self . parse_ident ( ) ?;
48394839 self . expect ( & token:: Eq ) ?;
48404840 let typ = self . parse_ty ( ) ?;
48414841 self . expect ( & token:: Semi ) ?;
4842- ( name, ast:: ImplItemKind :: Type ( typ) )
4842+ ( name, ast:: ImplItemKind :: Type ( typ) , ast :: Generics :: default ( ) )
48434843 } else if self . is_const_item ( ) {
48444844 self . expect_keyword ( keywords:: Const ) ?;
48454845 let name = self . parse_ident ( ) ?;
@@ -4848,11 +4848,11 @@ impl<'a> Parser<'a> {
48484848 self . expect ( & token:: Eq ) ?;
48494849 let expr = self . parse_expr ( ) ?;
48504850 self . expect ( & token:: Semi ) ?;
4851- ( name, ast:: ImplItemKind :: Const ( typ, expr) )
4851+ ( name, ast:: ImplItemKind :: Const ( typ, expr) , ast :: Generics :: default ( ) )
48524852 } else {
4853- let ( name, inner_attrs, node) = self . parse_impl_method ( & vis, at_end) ?;
4853+ let ( name, inner_attrs, generics , node) = self . parse_impl_method ( & vis, at_end) ?;
48544854 attrs. extend ( inner_attrs) ;
4855- ( name, node)
4855+ ( name, node, generics )
48564856 } ;
48574857
48584858 Ok ( ImplItem {
@@ -4862,6 +4862,7 @@ impl<'a> Parser<'a> {
48624862 vis,
48634863 defaultness,
48644864 attrs,
4865+ generics,
48654866 node,
48664867 tokens : None ,
48674868 } )
@@ -4919,7 +4920,7 @@ impl<'a> Parser<'a> {
49194920
49204921 /// Parse a method or a macro invocation in a trait impl.
49214922 fn parse_impl_method ( & mut self , vis : & Visibility , at_end : & mut bool )
4922- -> PResult < ' a , ( Ident , Vec < ast:: Attribute > , ast:: ImplItemKind ) > {
4923+ -> PResult < ' a , ( Ident , Vec < ast:: Attribute > , ast:: Generics , ast :: ImplItemKind ) > {
49234924 // code copied from parse_macro_use_or_failure... abstraction!
49244925 if self . token . is_path_start ( ) {
49254926 // Method macro.
@@ -4946,7 +4947,7 @@ impl<'a> Parser<'a> {
49464947 }
49474948
49484949 let mac = respan ( lo. to ( self . prev_span ) , Mac_ { path : pth, tts : tts } ) ;
4949- Ok ( ( keywords:: Invalid . ident ( ) , vec ! [ ] , ast:: ImplItemKind :: Macro ( mac) ) )
4950+ Ok ( ( keywords:: Invalid . ident ( ) , vec ! [ ] , ast:: Generics :: default ( ) , ast :: ImplItemKind :: Macro ( mac) ) )
49504951 } else {
49514952 let ( constness, unsafety, abi) = self . parse_fn_front_matter ( ) ?;
49524953 let ident = self . parse_ident ( ) ?;
@@ -4955,8 +4956,7 @@ impl<'a> Parser<'a> {
49554956 generics. where_clause = self . parse_where_clause ( ) ?;
49564957 * at_end = true ;
49574958 let ( inner_attrs, body) = self . parse_inner_attrs_and_block ( ) ?;
4958- Ok ( ( ident, inner_attrs, ast:: ImplItemKind :: Method ( ast:: MethodSig {
4959- generics,
4959+ Ok ( ( ident, inner_attrs, generics, ast:: ImplItemKind :: Method ( ast:: MethodSig {
49604960 abi,
49614961 unsafety,
49624962 constness,
0 commit comments