diff options
| author | Maybe Waffle <waffle.lapkin@gmail.com> | 2022-11-24 18:13:30 +0000 |
|---|---|---|
| committer | Maybe Waffle <waffle.lapkin@gmail.com> | 2022-11-24 18:18:45 +0000 |
| commit | e143fa21566b4ff32fe8a140642d8037a03a237f (patch) | |
| tree | 6c9621cf5442750f14c443771c1317e2b83a2622 | |
| parent | 550319059dcb94227e79f795a84636232a8528d8 (diff) | |
| download | rust-e143fa21566b4ff32fe8a140642d8037a03a237f.tar.gz rust-e143fa21566b4ff32fe8a140642d8037a03a237f.zip | |
nested-match mutability (proposed by the reviewer)
| -rw-r--r-- | compiler/rustc_ast_lowering/src/lib.rs | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/compiler/rustc_ast_lowering/src/lib.rs b/compiler/rustc_ast_lowering/src/lib.rs index 68bcdd828de..4ec943f33e2 100644 --- a/compiler/rustc_ast_lowering/src/lib.rs +++ b/compiler/rustc_ast_lowering/src/lib.rs @@ -1781,12 +1781,10 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { // Given we are only considering `ImplicitSelf` types, we needn't consider // the case where we have a mutable pattern to a reference as that would // no longer be an `ImplicitSelf`. - TyKind::Rptr(_, mt) if mt.ty.kind.is_implicit_self() && mt.mutbl.is_mut() => { - hir::ImplicitSelfKind::MutRef - } - TyKind::Rptr(_, mt) if mt.ty.kind.is_implicit_self() => { - hir::ImplicitSelfKind::ImmRef - } + TyKind::Rptr(_, mt) if mt.ty.kind.is_implicit_self() => match mt.mutbl { + hir::Mutability::Not => hir::ImplicitSelfKind::ImmRef, + hir::Mutability::Mut => hir::ImplicitSelfKind::MutRef, + }, _ => hir::ImplicitSelfKind::None, } }), |
