@@ -130,13 +130,14 @@ enum AdjustMode {
130130 /// Peel off all immediate reference types.
131131 Peel ,
132132 /// Reset binding mode to the initial mode.
133+ /// Used for destructuring assignment, where we don't want any match ergonomics.
133134 Reset ,
134135 /// Produced by ref patterns.
135136 /// Reset the binding mode to the initial mode,
136137 /// and if the old biding mode was by-reference
137138 /// with mutability matching the pattern,
138139 /// mark the pattern as having consumed this reference.
139- RefReset ( Mutability ) ,
140+ ResetAndConsumeRef ( Mutability ) ,
140141 /// Pass on the input binding mode and expected type.
141142 Pass ,
142143}
@@ -292,7 +293,9 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
292293 match adjust_mode {
293294 AdjustMode :: Pass => ( expected, def_bm, false ) ,
294295 AdjustMode :: Reset => ( expected, INITIAL_BM , false ) ,
295- AdjustMode :: RefReset ( mutbl) => ( expected, INITIAL_BM , def_bm. 0 == ByRef :: Yes ( mutbl) ) ,
296+ AdjustMode :: ResetAndConsumeRef ( mutbl) => {
297+ ( expected, INITIAL_BM , def_bm. 0 == ByRef :: Yes ( mutbl) )
298+ }
296299 AdjustMode :: Peel => {
297300 let peeled = self . peel_off_references ( pat, expected, def_bm) ;
298301 ( peeled. 0 , peeled. 1 , false )
@@ -351,7 +354,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
351354 // ```
352355 //
353356 // See issue #46688.
354- PatKind :: Ref ( _, mutbl) => AdjustMode :: RefReset ( * mutbl) ,
357+ PatKind :: Ref ( _, mutbl) => AdjustMode :: ResetAndConsumeRef ( * mutbl) ,
355358 // A `_` pattern works with any expected type, so there's no need to do anything.
356359 PatKind :: Wild
357360 // A malformed pattern doesn't have an expected type, so let's just accept any type.
0 commit comments