@@ -622,12 +622,20 @@ impl Sig for ast::Generics {
622
622
623
623
let mut defs = Vec :: with_capacity ( self . params . len ( ) ) ;
624
624
for param in & self . params {
625
- let mut param_text = param. ident . to_string ( ) ;
625
+ let mut param_text = String :: new ( ) ;
626
+ if let ast:: GenericParamKind :: Const { .. } = param. kind {
627
+ param_text. push_str ( "const " ) ;
628
+ }
629
+ param_text. push_str ( & param. ident . as_str ( ) ) ;
626
630
defs. push ( SigElement {
627
631
id : id_from_node_id ( param. id , scx) ,
628
632
start : offset + text. len ( ) ,
629
- end : offset + text. len ( ) + param_text. len ( ) ,
633
+ end : offset + text. len ( ) + param_text. as_str ( ) . len ( ) ,
630
634
} ) ;
635
+ if let ast:: GenericParamKind :: Const { ref ty } = param. kind {
636
+ param_text. push_str ( ": " ) ;
637
+ param_text. push_str ( & pprust:: ty_to_string ( & ty) ) ;
638
+ }
631
639
if !param. bounds . is_empty ( ) {
632
640
param_text. push_str ( ": " ) ;
633
641
match param. kind {
@@ -646,10 +654,8 @@ impl Sig for ast::Generics {
646
654
param_text. push_str ( & pprust:: bounds_to_string ( & param. bounds ) ) ;
647
655
// FIXME descend properly into bounds.
648
656
}
649
- ast:: GenericParamKind :: Const { ref ty } => {
650
- param_text. push_str ( & pprust:: bounds_to_string ( & param. bounds ) ) ;
651
- param_text. push_str ( "= " ) ;
652
- param_text. push_str ( & pprust:: ty_to_string ( & ty) ) ;
657
+ ast:: GenericParamKind :: Const { .. } => {
658
+ // Const generics cannot contain bounds.
653
659
}
654
660
}
655
661
}
0 commit comments