1
Fork 0

Handle and test wildcard arguments

This commit is contained in:
Joshua Nelson 2020-11-10 07:49:06 -05:00
parent 2baa0ceff4
commit 38127caf73
3 changed files with 11 additions and 3 deletions

View file

@ -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);