Change:
<img width="1016" alt="rustdoc output screenshot" src="https://user-"This example was tested on Rust 1.46.0, but it has been broken for quite a while. For example, see ).
Relevant code: Not sure what's going wrong.
Thanks for the helpful hint, However, I'm not convinced this is the root cause because it's happening to all mutable by-value function arguments, not just to functions with as the first argument. For example, this free function emits similar results: <img width="1004" alt="Screen Shot 2020-09-15 at 9 56 26 AM" src="https://user-"I think the actual root cause may be deeper than the interpretation of types, but I can't tell for sure.
This example confirms that the behavior appears to be per-argument instead of per-function. It's not like one bad argument ruins the formatting of the entire function. <img width="983" alt="Screen Shot 2020-09-15 at 10 04 39 AM" src="https://user-"Perhaps we could investigate where in the code the text is being generated and work our way backwards to see what is triggering it?
Hmm, the only relevant location I could find through GitHub search is in in : Is operating on a desugared form of the AST? I don't think this is the case, since is being successfully displayed here. Is there something else I'm missing?
Here's the issue: Looks like it should use  instead. Are you interested in making a PR? ;)
Yes, rustdoc works on a desugared version and has to reconstruct the by hand.
Sure, I will prepare one right away. Thanks for investigating with me.

Discussion:
// Check if this is a binding pattern, if so, we can optimize and avoid adding a // `let <pat> = __argN;` statement. In this case, we do not rename the parameter. let (ident, is_simple_parameter) = match parameter.pat.kind { <del> hir::PatKind::Binding(hir::BindingAnnotation::Unannotated, _, ident, _) => { (ident, true) </del> <ins> hir::PatKind::Binding( hir::BindingAnnotation::Unannotated | hir::BindingAnnotation::Mutable, _, ident, _, ) => (ident, true), // 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) </ins> } _ => { // Replace the ident for bindings that aren't simple.

// edition:2018 <ins> #![feature(min_const_generics)] </ins> // @has async_fn/fn.foo.html '//pre[@class="rust fn"]' 'pub async fn foo() -> Option<Foo>' pub async fn foo() -> Option<Foo> {

'⚠' } <ins> // @has async_fn/fn.mut_args.html '//pre[@class="rust fn"]' 'pub async fn mut_args(a: usize)' pub async fn mut_args(mut a: usize) {} // @has async_fn/fn.mut_ref.html '//pre[@class="rust fn"]' 'pub async fn mut_ref(x: i32)' pub async fn mut_ref(ref mut x: i32) {} </ins> trait Bar {} impl Bar for () {}

// @has async_fn/struct.Foo.html // @matches - '//code' 'pub async fn f()$' // @matches - '//code' 'pub async unsafe fn g()$' <ins> // @matches - '//code' 'pub async fn mut_self(self, first: usize)$' </ins> pub struct Foo; impl Foo { pub async fn f() {} pub async unsafe fn g() {} <ins> pub async fn mut_self(mut self, mut first: usize) {} </ins> } <ins> 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>) {} </ins>

} // @has foo/fn.b_sink.html '//pre[@class="rust fn"]'  <del> //      'pub async fn b_sink<const N: usize>(__arg0: impl Trait<N>)' // FIXME(const_generics): This should be `_` not `__arg0`. </del> <ins> //      'pub async fn b_sink<const N: usize>(_: impl Trait<N>)' </ins> pub async fn b_sink<const N: usize>(_: impl Trait<N>) {} // @has foo/fn.concrete.html '//pre[@class="rust fn"]'