@@ -181,7 +181,6 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
181
181
let closure = self . add_moved_or_invoked_closure_note ( location, used_place, & mut err) ;
182
182
183
183
let mut is_loop_move = false ;
184
- let mut in_pattern = false ;
185
184
let mut seen_spans = FxIndexSet :: default ( ) ;
186
185
187
186
for move_site in & move_site_vec {
@@ -204,7 +203,6 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
204
203
self . suggest_ref_or_clone (
205
204
mpi,
206
205
& mut err,
207
- & mut in_pattern,
208
206
move_spans,
209
207
moved_place. as_ref ( ) ,
210
208
& mut has_suggest_reborrow,
@@ -256,15 +254,6 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
256
254
let place = & self . move_data . move_paths [ mpi] . place ;
257
255
let ty = place. ty ( self . body , self . infcx . tcx ) . ty ;
258
256
259
- // If we're in pattern, we do nothing in favor of the previous suggestion (#80913).
260
- // Same for if we're in a loop, see #101119.
261
- if is_loop_move & !in_pattern && !matches ! ( use_spans, UseSpans :: ClosureUse { .. } ) {
262
- if let ty:: Ref ( _, _, hir:: Mutability :: Mut ) = ty. kind ( ) {
263
- // We have a `&mut` ref, we need to reborrow on each iteration (#62112).
264
- self . suggest_reborrow ( & mut err, span, moved_place) ;
265
- }
266
- }
267
-
268
257
if self . infcx . param_env . caller_bounds ( ) . iter ( ) . any ( |c| {
269
258
c. as_trait_clause ( ) . is_some_and ( |pred| {
270
259
pred. skip_binder ( ) . self_ty ( ) == ty && self . infcx . tcx . is_fn_trait ( pred. def_id ( ) )
@@ -330,7 +319,6 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
330
319
& self ,
331
320
mpi : MovePathIndex ,
332
321
err : & mut Diag < ' infcx > ,
333
- in_pattern : & mut bool ,
334
322
move_spans : UseSpans < ' tcx > ,
335
323
moved_place : PlaceRef < ' tcx > ,
336
324
has_suggest_reborrow : & mut bool ,
@@ -545,7 +533,6 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
545
533
&& !move_span. is_dummy ( )
546
534
&& !self . infcx . tcx . sess . source_map ( ) . is_imported ( move_span)
547
535
{
548
- * in_pattern = true ;
549
536
let mut sugg = vec ! [ ( pat. span. shrink_to_lo( ) , "ref " . to_string( ) ) ] ;
550
537
if let Some ( pat) = finder. parent_pat {
551
538
sugg. insert ( 0 , ( pat. span . shrink_to_lo ( ) , "ref " . to_string ( ) ) ) ;
0 commit comments