Handle and test wildcard arguments
This commit is contained in:
parent
2baa0ceff4
commit
38127caf73
3 changed files with 11 additions and 3 deletions
|
@ -1102,10 +1102,13 @@ impl<'hir> LoweringContext<'_, 'hir> {
|
|||
ident,
|
||||
_,
|
||||
) => (ident, true),
|
||||
// For `ref mut` arguments, we can't reuse the binding, but
|
||||
// For `ref mut` or wildcard arguments, we can't reuse the binding, but
|
||||
// we can keep the same name for the parameter.
|
||||
// This lets rustdoc render it correctly in documentation.
|
||||
hir::PatKind::Binding(_, _, ident, _) => (ident, false),
|
||||
hir::PatKind::Wild => {
|
||||
(Ident::with_dummy_span(rustc_span::symbol::kw::Underscore), false)
|
||||
}
|
||||
_ => {
|
||||
// Replace the ident for bindings that aren't simple.
|
||||
let name = format!("__arg{}", index);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue