about summary refs log tree commit diff
path: root/compiler/rustc_ast_lowering/src
diff options
context:
space:
mode:
authorJoshua Nelson <jyn514@gmail.com>2020-11-10 07:49:06 -0500
committerJoshua Nelson <jyn514@gmail.com>2020-11-12 11:14:29 -0500
commit38127caf730ab6e99d3ea546db4c2df69229afba (patch)
tree302dd644286e9ccd5e4707606ecab366cb15dc04 /compiler/rustc_ast_lowering/src
parent2baa0ceff4e6dc75751fdca4be68e87f5cf35a6e (diff)
downloadrust-38127caf730ab6e99d3ea546db4c2df69229afba.tar.gz
rust-38127caf730ab6e99d3ea546db4c2df69229afba.zip
Handle and test wildcard arguments
Diffstat (limited to 'compiler/rustc_ast_lowering/src')
-rw-r--r--compiler/rustc_ast_lowering/src/item.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/compiler/rustc_ast_lowering/src/item.rs b/compiler/rustc_ast_lowering/src/item.rs
index 1335bb02580..d353bc19f7a 100644
--- a/compiler/rustc_ast_lowering/src/item.rs
+++ b/compiler/rustc_ast_lowering/src/item.rs
@@ -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);