Consider mutable ident binding patterns to be simple

This should fix `rustdoc` rendering of by-value mutable arguments in
`async fn` contexts.
This commit is contained in:
Eyal Kalderon 2020-09-15 10:21:59 +08:00 committed by Joshua Nelson
parent 7f5a42b073
commit 380b222f52

View file

@ -1096,9 +1096,12 @@ impl<'hir> LoweringContext<'_, 'hir> {
// 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 {
hir::PatKind::Binding(hir::BindingAnnotation::Unannotated, _, ident, _) => {
(ident, true)
}
hir::PatKind::Binding(
hir::BindingAnnotation::Unannotated | hir::BindingAnnotation::Mutable,
_,
ident,
_,
) => (ident, true),
_ => {
// Replace the ident for bindings that aren't simple.
let name = format!("__arg{}", index);