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.
1 parent aeab250 commit 3c75b1eCopy full SHA for 3c75b1e
src/librustdoc/clean/mod.rs
@@ -1948,9 +1948,16 @@ fn name_from_pat(p: &ast::Pat) -> String {
1948
PatWildMulti => "..".to_string(),
1949
PatIdent(_, ref p, _) => token::get_ident(p.node).get().to_string(),
1950
PatEnum(ref p, _) => path_to_string(p),
1951
- PatStruct(..) => fail!("tried to get argument name from pat_struct, \
1952
- which is not allowed in function arguments"),
1953
- PatTup(..) => "(tuple arg NYI)".to_string(),
+ PatStruct(ref name, ref fields, etc) => {
+ format!("{} {{ {}{} }}", path_to_string(name),
+ fields.iter().map(|fp|
1954
+ format!("{}: {}", fp.ident.as_str(), name_from_pat(&*fp.pat)))
1955
+ .collect::<Vec<String>>().connect(", "),
1956
+ if etc { ", ..." } else { "" }
1957
+ )
1958
+ },
1959
+ PatTup(ref elts) => format!("({})", elts.iter().map(|p| name_from_pat(&**p))
1960
+ .collect::<Vec<String>>().connect(", ")),
1961
PatBox(p) => name_from_pat(&*p),
1962
PatRegion(p) => name_from_pat(&*p),
1963
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