Skip to content

Commit 380b222

Browse files
ebkalderonjyn514
authored andcommitted
Consider mutable ident binding patterns to be simple
This should fix `rustdoc` rendering of by-value mutable arguments in `async fn` contexts.
1 parent 7f5a42b commit 380b222

File tree

1 file changed

+6
-3
lines changed
  • compiler/rustc_ast_lowering/src

1 file changed

+6
-3
lines changed

compiler/rustc_ast_lowering/src/item.rs

+6-3
Original file line numberDiff line numberDiff line change
@@ -1096,9 +1096,12 @@ impl<'hir> LoweringContext<'_, 'hir> {
10961096
// Check if this is a binding pattern, if so, we can optimize and avoid adding a
10971097
// `let <pat> = __argN;` statement. In this case, we do not rename the parameter.
10981098
let (ident, is_simple_parameter) = match parameter.pat.kind {
1099-
hir::PatKind::Binding(hir::BindingAnnotation::Unannotated, _, ident, _) => {
1100-
(ident, true)
1101-
}
1099+
hir::PatKind::Binding(
1100+
hir::BindingAnnotation::Unannotated | hir::BindingAnnotation::Mutable,
1101+
_,
1102+
ident,
1103+
_,
1104+
) => (ident, true),
11021105
_ => {
11031106
// Replace the ident for bindings that aren't simple.
11041107
let name = format!("__arg{}", index);

0 commit comments

Comments
 (0)