@@ -1722,33 +1722,20 @@ impl<'a> State<'a> {
1722
1722
}
1723
1723
} ;
1724
1724
1725
- let mut types = vec ! [ ] ;
1726
- let mut elide_lifetimes = true ;
1727
- for arg in & generic_args. args {
1728
- match arg {
1729
- GenericArg :: Lifetime ( lt) => {
1730
- if !lt. is_elided ( ) {
1731
- elide_lifetimes = false ;
1732
- }
1733
- }
1734
- GenericArg :: Type ( ty) => {
1735
- types. push ( ty) ;
1736
- }
1737
- GenericArg :: Const ( _ct) => unimplemented ! ( ) , // TODO(const_generics):
1738
- }
1739
- }
1725
+ let elide_lifetimes = generic_args. args . iter ( ) . all ( |arg| match arg {
1726
+ GenericArg :: Lifetime ( lt) => lt. is_elided ( ) ,
1727
+ _ => true ,
1728
+ } ) ;
1740
1729
if !elide_lifetimes {
1741
1730
start_or_comma ( self ) ?;
1742
1731
self . commasep ( Inconsistent , & generic_args. args , |s, generic_arg| {
1743
1732
match generic_arg {
1744
- GenericArg :: Lifetime ( lt) => s. print_lifetime ( lt) ,
1733
+ GenericArg :: Lifetime ( lt) if !elide_lifetimes => s. print_lifetime ( lt) ,
1734
+ GenericArg :: Lifetime ( _) => Ok ( ( ) ) ,
1745
1735
GenericArg :: Type ( ty) => s. print_type ( ty) ,
1746
- GenericArg :: Const ( _ct ) => unimplemented ! ( ) , // TODO(const_generics):
1736
+ GenericArg :: Const ( ct ) => s . print_anon_const ( & ct . value ) ,
1747
1737
}
1748
1738
} ) ?;
1749
- } else if !types. is_empty ( ) {
1750
- start_or_comma ( self ) ?;
1751
- self . commasep ( Inconsistent , & types, |s, ty| s. print_type ( & ty) ) ?;
1752
1739
}
1753
1740
1754
1741
// FIXME(eddyb) This would leak into error messages, e.g.:
0 commit comments