about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEyal Kalderon <ebkalderon@gmail.com>2020-09-15 10:21:59 +0800
committerJoshua Nelson <jyn514@gmail.com>2020-11-12 11:13:05 -0500
commit380b222f52ee2f506d35ba89bbd8f83f6469f31f (patch)
tree238594d35b95da49c94eaf1edeabba2e55a77c2c
parent7f5a42b073dc2bee2aa625052eb066ee07072048 (diff)
downloadrust-380b222f52ee2f506d35ba89bbd8f83f6469f31f.tar.gz
rust-380b222f52ee2f506d35ba89bbd8f83f6469f31f.zip
Consider mutable ident binding patterns to be simple
This should fix `rustdoc` rendering of by-value mutable arguments in
`async fn` contexts.
-rw-r--r--compiler/rustc_ast_lowering/src/item.rs9
1 files changed, 6 insertions, 3 deletions
diff --git a/compiler/rustc_ast_lowering/src/item.rs b/compiler/rustc_ast_lowering/src/item.rs
index 617cacee0e7..0cfcd843ddd 100644
--- a/compiler/rustc_ast_lowering/src/item.rs
+++ b/compiler/rustc_ast_lowering/src/item.rs
@@ -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);