@@ -32,7 +32,7 @@ impl<'a> State<'a> {
3232 }
3333 ast:: ForeignItemKind :: Static ( ty, mutbl, body) => {
3434 let def = ast:: Defaultness :: Final ;
35- self . print_item_const ( ident, Some ( * mutbl) , ty, body. as_deref ( ) , vis, def) ;
35+ self . print_item_const ( ident, Some ( * mutbl) , None , ty, body. as_deref ( ) , vis, def) ;
3636 }
3737 ast:: ForeignItemKind :: TyAlias ( box ast:: TyAlias {
3838 defaultness,
@@ -67,6 +67,7 @@ impl<'a> State<'a> {
6767 & mut self ,
6868 ident : Ident ,
6969 mutbl : Option < ast:: Mutability > ,
70+ generics : Option < & ast:: Generics > ,
7071 ty : & ast:: Ty ,
7172 body : Option < & ast:: Expr > ,
7273 vis : & ast:: Visibility ,
@@ -82,6 +83,9 @@ impl<'a> State<'a> {
8283 } ;
8384 self . word_space ( leading) ;
8485 self . print_ident ( ident) ;
86+ if let Some ( generics) = generics {
87+ self . print_generic_params ( & generics. params ) ;
88+ }
8589 self . word_space ( ":" ) ;
8690 self . print_type ( ty) ;
8791 if body. is_some ( ) {
@@ -92,6 +96,9 @@ impl<'a> State<'a> {
9296 self . word_space ( "=" ) ;
9397 self . print_expr ( body) ;
9498 }
99+ if let Some ( generics) = generics {
100+ self . print_where_clause ( & generics. where_clause ) ;
101+ }
95102 self . word ( ";" ) ;
96103 self . end ( ) ; // end the outer cbox
97104 }
@@ -162,16 +169,18 @@ impl<'a> State<'a> {
162169 self . print_item_const (
163170 item. ident ,
164171 Some ( * mutbl) ,
172+ None ,
165173 ty,
166174 body. as_deref ( ) ,
167175 & item. vis ,
168176 def,
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+ Some ( 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+ Some ( 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