File tree Expand file tree Collapse file tree 1 file changed +20
-1
lines changed
Expand file tree Collapse file tree 1 file changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -1338,7 +1338,26 @@ pub(crate) mod printing {
13381338 fn to_tokens ( & self , tokens : & mut TokenStream ) {
13391339 self . use_token . to_tokens ( tokens) ;
13401340 self . lt_token . to_tokens ( tokens) ;
1341- self . params . to_tokens ( tokens) ;
1341+
1342+ // Print lifetimes before types and consts, regardless of their
1343+ // order in self.params.
1344+ let mut trailing_or_empty = true ;
1345+ for param in self . params . pairs ( ) {
1346+ if let CapturedParam :: Lifetime ( _) = * * param. value ( ) {
1347+ param. to_tokens ( tokens) ;
1348+ trailing_or_empty = param. punct ( ) . is_some ( ) ;
1349+ }
1350+ }
1351+ for param in self . params . pairs ( ) {
1352+ if let CapturedParam :: Ident ( _) = * * param. value ( ) {
1353+ if !trailing_or_empty {
1354+ <Token ! [ , ] >:: default ( ) . to_tokens ( tokens) ;
1355+ trailing_or_empty = true ;
1356+ }
1357+ param. to_tokens ( tokens) ;
1358+ }
1359+ }
1360+
13421361 self . gt_token . to_tokens ( tokens) ;
13431362 }
13441363 }
You can’t perform that action at this time.
0 commit comments