about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/rustdoc-json-types/lib.rs4
-rw-r--r--src/test/rustdoc-json/fns/pattern_arg.rs7
2 files changed, 11 insertions, 0 deletions
diff --git a/src/rustdoc-json-types/lib.rs b/src/rustdoc-json-types/lib.rs
index 7379b04ad16..dbbdeecd99d 100644
--- a/src/rustdoc-json-types/lib.rs
+++ b/src/rustdoc-json-types/lib.rs
@@ -618,6 +618,10 @@ pub struct FunctionPointer {
 
 #[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
 pub struct FnDecl {
+    /// List of argument names and their type.
+    ///
+    /// Note that not all names will be valid identifiers, as some of
+    /// them may be patterns.
     pub inputs: Vec<(String, Type)>,
     pub output: Option<Type>,
     pub c_variadic: bool,
diff --git a/src/test/rustdoc-json/fns/pattern_arg.rs b/src/test/rustdoc-json/fns/pattern_arg.rs
new file mode 100644
index 00000000000..32b7da0fae4
--- /dev/null
+++ b/src/test/rustdoc-json/fns/pattern_arg.rs
@@ -0,0 +1,7 @@
+// @is "$.index[*][?(@.name=='fst')].inner.decl.inputs[0][0]" '"(x, _)"'
+pub fn fst<X, Y>((x, _): (X, Y)) -> X {
+    x
+}
+
+// @is "$.index[*][?(@.name=='drop_int')].inner.decl.inputs[0][0]" '"_"'
+pub fn drop_int(_: i32) {}