Skip to content

Allow rustdoc to accept vector pattern arguments #20512

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 5, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/librustdoc/clean/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down