From e5376f3947ba8faf0f7c3a9543366060d662357d Mon Sep 17 00:00:00 2001
From: Jules Bertholet <julesbertholet@quoi.xyz>
Date: Wed, 3 Apr 2024 20:35:02 -0400
Subject: [PATCH] Address final nits

---
 compiler/rustc_hir_typeck/src/pat.rs | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/compiler/rustc_hir_typeck/src/pat.rs b/compiler/rustc_hir_typeck/src/pat.rs
index 298047427cc..bb47f8dfba4 100644
--- a/compiler/rustc_hir_typeck/src/pat.rs
+++ b/compiler/rustc_hir_typeck/src/pat.rs
@@ -130,13 +130,14 @@ enum AdjustMode {
     /// Peel off all immediate reference types.
     Peel,
     /// Reset binding mode to the initial mode.
+    /// Used for destructuring assignment, where we don't want any match ergonomics.
     Reset,
     /// Produced by ref patterns.
     /// Reset the binding mode to the initial mode,
     /// and if the old biding mode was by-reference
     /// with mutability matching the pattern,
     /// mark the pattern as having consumed this reference.
-    RefReset(Mutability),
+    ResetAndConsumeRef(Mutability),
     /// Pass on the input binding mode and expected type.
     Pass,
 }
@@ -292,7 +293,9 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
         match adjust_mode {
             AdjustMode::Pass => (expected, def_bm, false),
             AdjustMode::Reset => (expected, INITIAL_BM, false),
-            AdjustMode::RefReset(mutbl) => (expected, INITIAL_BM, def_bm.0 == ByRef::Yes(mutbl)),
+            AdjustMode::ResetAndConsumeRef(mutbl) => {
+                (expected, INITIAL_BM, def_bm.0 == ByRef::Yes(mutbl))
+            }
             AdjustMode::Peel => {
                 let peeled = self.peel_off_references(pat, expected, def_bm);
                 (peeled.0, peeled.1, false)
@@ -351,7 +354,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
             // ```
             //
             // See issue #46688.
-            PatKind::Ref(_, mutbl) => AdjustMode::RefReset(*mutbl),
+            PatKind::Ref(_, mutbl) => AdjustMode::ResetAndConsumeRef(*mutbl),
             // A `_` pattern works with any expected type, so there's no need to do anything.
             PatKind::Wild
             // A malformed pattern doesn't have an expected type, so let's just accept any type.