diff --git a/compiler/rustc_ast_lowering/src/item.rs b/compiler/rustc_ast_lowering/src/item.rs index 1335bb02580f..d353bc19f7ae 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); diff --git a/src/test/rustdoc/async-fn.rs b/src/test/rustdoc/async-fn.rs index d7c890738299..e7a7d1831f73 100644 --- a/src/test/rustdoc/async-fn.rs +++ b/src/test/rustdoc/async-fn.rs @@ -1,4 +1,5 @@ // edition:2018 +#![feature(min_const_generics)] // @has async_fn/fn.foo.html '//pre[@class="rust fn"]' 'pub async fn foo() -> Option' pub async fn foo() -> Option { @@ -46,3 +47,8 @@ impl Foo { pub async unsafe fn g() {} pub async fn mut_self(mut self, mut first: usize) {} } + +pub trait Trait {} +// @has async_fn/fn.const_generics.html +// @has - '//pre[@class="rust fn"]' 'pub async fn const_generics(_: impl Trait)' +pub async fn const_generics(_: impl Trait) {} diff --git a/src/test/rustdoc/const-generics/const-generics-docs.rs b/src/test/rustdoc/const-generics/const-generics-docs.rs index 8dcba36600d2..9c68e067c6f8 100644 --- a/src/test/rustdoc/const-generics/const-generics-docs.rs +++ b/src/test/rustdoc/const-generics/const-generics-docs.rs @@ -70,8 +70,7 @@ pub async fn a_sink(v: [u8; N]) -> impl Trait { } // @has foo/fn.b_sink.html '//pre[@class="rust fn"]' \ -// 'pub async fn b_sink(__arg0: impl Trait)' -// FIXME(const_generics): This should be `_` not `__arg0`. +// 'pub async fn b_sink(_: impl Trait)' pub async fn b_sink(_: impl Trait) {} // @has foo/fn.concrete.html '//pre[@class="rust fn"]' \