We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents f2d251d + 3c75b1e commit e178ebfCopy full SHA for e178ebf
src/librustdoc/clean/mod.rs
@@ -1951,9 +1951,16 @@ fn name_from_pat(p: &ast::Pat) -> String {
1951
PatWildMulti => "..".to_string(),
1952
PatIdent(_, ref p, _) => token::get_ident(p.node).get().to_string(),
1953
PatEnum(ref p, _) => path_to_string(p),
1954
- PatStruct(..) => fail!("tried to get argument name from pat_struct, \
1955
- which is not allowed in function arguments"),
1956
- PatTup(..) => "(tuple arg NYI)".to_string(),
+ PatStruct(ref name, ref fields, etc) => {
+ format!("{} {{ {}{} }}", path_to_string(name),
+ fields.iter().map(|fp|
1957
+ format!("{}: {}", fp.ident.as_str(), name_from_pat(&*fp.pat)))
1958
+ .collect::<Vec<String>>().connect(", "),
1959
+ if etc { ", ..." } else { "" }
1960
+ )
1961
+ },
1962
+ PatTup(ref elts) => format!("({})", elts.iter().map(|p| name_from_pat(&**p))
1963
+ .collect::<Vec<String>>().connect(", ")),
1964
PatBox(p) => name_from_pat(&*p),
1965
PatRegion(p) => name_from_pat(&*p),
1966
PatLit(..) => {
src/test/run-make/rustdoc-smoke/foo.rs
@@ -22,4 +22,8 @@ pub mod bar {
22
23
/// *wow*
24
pub trait Doge { }
25
+
26
+ pub struct Foo { x: int, y: uint }
27
28
+ pub fn prawns((a, b): (int, uint), Foo { x, y }: Foo) { }
29
}
0 commit comments