@@ -30,10 +30,15 @@ impl<'a> State<'a> {
3030 ast:: ForeignItemKind :: Fn ( box ast:: Fn { defaultness, sig, generics, body } ) => {
3131 self . print_fn_full ( sig, ident, generics, vis, * defaultness, body. as_deref ( ) , attrs) ;
3232 }
33- ast:: ForeignItemKind :: Static ( ty, mutbl, body) => {
34- let def = ast:: Defaultness :: Final ;
35- self . print_item_const ( ident, Some ( * mutbl) , ty, body. as_deref ( ) , vis, def) ;
36- }
33+ ast:: ForeignItemKind :: Static ( ty, mutbl, body) => self . print_item_const (
34+ ident,
35+ Some ( * mutbl) ,
36+ & ast:: Generics :: default ( ) ,
37+ ty,
38+ body. as_deref ( ) ,
39+ vis,
40+ ast:: Defaultness :: Final ,
41+ ) ,
3742 ast:: ForeignItemKind :: TyAlias ( box ast:: TyAlias {
3843 defaultness,
3944 generics,
@@ -67,6 +72,7 @@ impl<'a> State<'a> {
6772 & mut self ,
6873 ident : Ident ,
6974 mutbl : Option < ast:: Mutability > ,
75+ generics : & ast:: Generics ,
7076 ty : & ast:: Ty ,
7177 body : Option < & ast:: Expr > ,
7278 vis : & ast:: Visibility ,
@@ -82,6 +88,7 @@ impl<'a> State<'a> {
8288 } ;
8389 self . word_space ( leading) ;
8490 self . print_ident ( ident) ;
91+ self . print_generic_params ( & generics. params ) ;
8592 self . word_space ( ":" ) ;
8693 self . print_type ( ty) ;
8794 if body. is_some ( ) {
@@ -92,6 +99,7 @@ impl<'a> State<'a> {
9299 self . word_space ( "=" ) ;
93100 self . print_expr ( body) ;
94101 }
102+ self . print_where_clause ( & generics. where_clause ) ;
95103 self . word ( ";" ) ;
96104 self . end ( ) ; // end the outer cbox
97105 }
@@ -158,20 +166,21 @@ impl<'a> State<'a> {
158166 self . word ( ";" ) ;
159167 }
160168 ast:: ItemKind :: Static ( box StaticItem { ty, mutability : mutbl, expr : body } ) => {
161- let def = ast:: Defaultness :: Final ;
162169 self . print_item_const (
163170 item. ident ,
164171 Some ( * mutbl) ,
172+ & ast:: Generics :: default ( ) ,
165173 ty,
166174 body. as_deref ( ) ,
167175 & item. vis ,
168- def ,
176+ ast :: Defaultness :: Final ,
169177 ) ;
170178 }
171- ast:: ItemKind :: Const ( box ast:: ConstItem { defaultness, ty, expr } ) => {
179+ ast:: ItemKind :: Const ( box ast:: ConstItem { defaultness, generics , ty, expr } ) => {
172180 self . print_item_const (
173181 item. ident ,
174182 None ,
183+ generics,
175184 ty,
176185 expr. as_deref ( ) ,
177186 & item. vis ,
@@ -515,8 +524,16 @@ impl<'a> State<'a> {
515524 ast:: AssocItemKind :: Fn ( box ast:: Fn { defaultness, sig, generics, body } ) => {
516525 self . print_fn_full ( sig, ident, generics, vis, * defaultness, body. as_deref ( ) , attrs) ;
517526 }
518- ast:: AssocItemKind :: Const ( box ast:: ConstItem { defaultness, ty, expr } ) => {
519- self . print_item_const ( ident, None , ty, expr. as_deref ( ) , vis, * defaultness) ;
527+ ast:: AssocItemKind :: Const ( box ast:: ConstItem { defaultness, generics, ty, expr } ) => {
528+ self . print_item_const (
529+ ident,
530+ None ,
531+ generics,
532+ ty,
533+ expr. as_deref ( ) ,
534+ vis,
535+ * defaultness,
536+ ) ;
520537 }
521538 ast:: AssocItemKind :: Type ( box ast:: TyAlias {
522539 defaultness,
0 commit comments