@@ -181,7 +181,6 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
181181 let closure = self . add_moved_or_invoked_closure_note ( location, used_place, & mut err) ;
182182
183183 let mut is_loop_move = false ;
184- let mut in_pattern = false ;
185184 let mut seen_spans = FxIndexSet :: default ( ) ;
186185
187186 for move_site in & move_site_vec {
@@ -204,7 +203,6 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
204203 self . suggest_ref_or_clone (
205204 mpi,
206205 & mut err,
207- & mut in_pattern,
208206 move_spans,
209207 moved_place. as_ref ( ) ,
210208 & mut has_suggest_reborrow,
@@ -256,15 +254,6 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
256254 let place = & self . move_data . move_paths [ mpi] . place ;
257255 let ty = place. ty ( self . body , self . infcx . tcx ) . ty ;
258256
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-
268257 if self . infcx . param_env . caller_bounds ( ) . iter ( ) . any ( |c| {
269258 c. as_trait_clause ( ) . is_some_and ( |pred| {
270259 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> {
330319 & self ,
331320 mpi : MovePathIndex ,
332321 err : & mut Diag < ' infcx > ,
333- in_pattern : & mut bool ,
334322 move_spans : UseSpans < ' tcx > ,
335323 moved_place : PlaceRef < ' tcx > ,
336324 has_suggest_reborrow : & mut bool ,
@@ -545,7 +533,6 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
545533 && !move_span. is_dummy ( )
546534 && !self . infcx . tcx . sess . source_map ( ) . is_imported ( move_span)
547535 {
548- * in_pattern = true ;
549536 let mut sugg = vec ! [ ( pat. span. shrink_to_lo( ) , "ref " . to_string( ) ) ] ;
550537 if let Some ( pat) = finder. parent_pat {
551538 sugg. insert ( 0 , ( pat. span . shrink_to_lo ( ) , "ref " . to_string ( ) ) ) ;
0 commit comments