Handle and test wildcard arguments
This commit is contained in:
parent
2baa0ceff4
commit
38127caf73
@ -1102,10 +1102,13 @@ fn lower_maybe_async_body(
|
||||
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);
|
||||
|
@ -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<Foo>'
|
||||
pub async fn foo() -> Option<Foo> {
|
||||
@ -46,3 +47,8 @@ pub async fn f() {}
|
||||
pub async unsafe fn g() {}
|
||||
pub async fn mut_self(mut self, mut first: usize) {}
|
||||
}
|
||||
|
||||
pub trait Trait<const N: usize> {}
|
||||
// @has async_fn/fn.const_generics.html
|
||||
// @has - '//pre[@class="rust fn"]' 'pub async fn const_generics<const N: usize>(_: impl Trait<N>)'
|
||||
pub async fn const_generics<const N: usize>(_: impl Trait<N>) {}
|
||||
|
@ -70,8 +70,7 @@ pub fn test<const N: usize>() -> impl Trait<N> where u8: Trait<N> {
|
||||
}
|
||||
|
||||
// @has foo/fn.b_sink.html '//pre[@class="rust fn"]' \
|
||||
// 'pub async fn b_sink<const N: usize>(__arg0: impl Trait<N>)'
|
||||
// FIXME(const_generics): This should be `_` not `__arg0`.
|
||||
// 'pub async fn b_sink<const N: usize>(_: impl Trait<N>)'
|
||||
pub async fn b_sink<const N: usize>(_: impl Trait<N>) {}
|
||||
|
||||
// @has foo/fn.concrete.html '//pre[@class="rust fn"]' \
|
||||
|
Loading…
Reference in New Issue
Block a user