rustdoc-json: Document and Test that args can be patterns.
This commit is contained in:
parent
ee1c3b385b
commit
bb04e7e2a2
@ -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,
|
||||
|
7
src/test/rustdoc-json/fns/pattern_arg.rs
Normal file
7
src/test/rustdoc-json/fns/pattern_arg.rs
Normal file
@ -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) {}
|
Loading…
x
Reference in New Issue
Block a user