File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -2243,8 +2243,12 @@ fn name_from_pat(p: &ast::Pat) -> String {
2243
2243
} ,
2244
2244
PatRange ( ..) => panic ! ( "tried to get argument name from PatRange, \
2245
2245
which is not allowed in function arguments") ,
2246
- PatVec ( ..) => panic ! ( "tried to get argument name from pat_vec, \
2247
- which is not allowed in function arguments") ,
2246
+ PatVec ( ref begin, ref mid, ref end) => {
2247
+ let begin = begin. iter ( ) . map ( |p| name_from_pat ( & * * p) ) ;
2248
+ let mid = mid. as_ref ( ) . map ( |p| format ! ( "..{}" , name_from_pat( & * * p) ) ) . into_iter ( ) ;
2249
+ let end = end. iter ( ) . map ( |p| name_from_pat ( & * * p) ) ;
2250
+ format ! ( "[{}]" , begin. chain( mid) . chain( end) . collect:: <Vec <_>>( ) . connect( ", " ) )
2251
+ } ,
2248
2252
PatMac ( ..) => {
2249
2253
warn ! ( "can't document the name of a function argument \
2250
2254
produced by a pattern macro") ;
You can’t perform that action at this time.
0 commit comments