Skip to content

Commit bb04e7e

Browse files
committed
rustdoc-json: Document and Test that args can be patterns.
1 parent ee1c3b3 commit bb04e7e

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
@@ -618,6 +618,10 @@ pub struct FunctionPointer {
618618

619619
#[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
620620
pub struct FnDecl {
621+
/// List of argument names and their type.
622+
///
623+
/// Note that not all names will be valid identifiers, as some of
624+
/// them may be patterns.
621625
pub inputs: Vec<(String, Type)>,
622626
pub output: Option<Type>,
623627
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)