Skip to content

Commit 091f5e1

Browse files
authored
Rollup merge of #103065 - aDotInTheVoid:rdj-arg-pattern, r=GuillaumeGomez
rustdoc-json: Document and Test that args can be patterns.
2 parents 90711a8 + bb04e7e commit 091f5e1

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

src/rustdoc-json-types/lib.rs

+4
Original file line numberDiff line numberDiff line change
@@ -615,6 +615,10 @@ pub struct FunctionPointer {
615615

616616
#[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
617617
pub struct FnDecl {
618+
/// List of argument names and their type.
619+
///
620+
/// Note that not all names will be valid identifiers, as some of
621+
/// them may be patterns.
618622
pub inputs: Vec<(String, Type)>,
619623
pub output: Option<Type>,
620624
pub c_variadic: bool,
+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// @is "$.index[*][?(@.name=='fst')].inner.decl.inputs[0][0]" '"(x, _)"'
2+
pub fn fst<X, Y>((x, _): (X, Y)) -> X {
3+
x
4+
}
5+
6+
// @is "$.index[*][?(@.name=='drop_int')].inner.decl.inputs[0][0]" '"_"'
7+
pub fn drop_int(_: i32) {}

0 commit comments

Comments
 (0)