提交 afdddefc 编写于 作者: B Brendan Zabarauskas

Allow rustdoc to accept vector pattern arguments

上级 496dc4ea
......@@ -2243,8 +2243,12 @@ fn name_from_pat(p: &ast::Pat) -> String {
},
PatRange(..) => panic!("tried to get argument name from PatRange, \
which is not allowed in function arguments"),
PatVec(..) => panic!("tried to get argument name from pat_vec, \
which is not allowed in function arguments"),
PatVec(ref begin, ref mid, ref end) => {
let begin = begin.iter().map(|p| name_from_pat(&**p));
let mid = mid.as_ref().map(|p| format!("..{}", name_from_pat(&**p))).into_iter();
let end = end.iter().map(|p| name_from_pat(&**p));
format!("[{}]", begin.chain(mid).chain(end).collect::<Vec<_>>().connect(", "))
},
PatMac(..) => {
warn!("can't document the name of a function argument \
produced by a pattern macro");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册