diff options
| author | Esteban Küber <esteban@kuber.com.ar> | 2025-07-21 16:53:31 +0000 |
|---|---|---|
| committer | Esteban Küber <esteban@kuber.com.ar> | 2025-07-23 16:04:45 +0000 |
| commit | 6237e735c4dc165b3efec236e11a44bdccf1dfd7 (patch) | |
| tree | 1478963bdcdf1d3655524a5387aeffce5c1b1549 /compiler | |
| parent | dafc9f9b534c8d1a50ba87f776eb1d6dfb1a7c94 (diff) | |
| download | rust-6237e735c4dc165b3efec236e11a44bdccf1dfd7.tar.gz rust-6237e735c4dc165b3efec236e11a44bdccf1dfd7.zip | |
Point at the type that doesn't impl `Clone` in more cases beyond closures
Diffstat (limited to 'compiler')
| -rw-r--r-- | compiler/rustc_borrowck/src/diagnostics/move_errors.rs | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/compiler/rustc_borrowck/src/diagnostics/move_errors.rs b/compiler/rustc_borrowck/src/diagnostics/move_errors.rs index 67dce7615c0..a0c1f66d35c 100644 --- a/compiler/rustc_borrowck/src/diagnostics/move_errors.rs +++ b/compiler/rustc_borrowck/src/diagnostics/move_errors.rs @@ -596,9 +596,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> { self.add_move_error_details(err, &binds_to); } // No binding. Nothing to suggest. - GroupedMoveError::OtherIllegalMove { - ref original_path, use_spans, ref kind, .. - } => { + GroupedMoveError::OtherIllegalMove { ref original_path, use_spans, .. } => { let mut use_span = use_spans.var_or_use(); let place_ty = original_path.ty(self.body, self.infcx.tcx).ty; let place_desc = match self.describe_place(original_path.as_ref()) { @@ -616,14 +614,11 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> { ); } - if let IllegalMoveOriginKind::BorrowedContent { target_place } = &kind - && let ty = target_place.ty(self.body, self.infcx.tcx).ty - && let ty::Closure(def_id, _) = ty.kind() - && def_id.as_local() == Some(self.mir_def_id()) - && let Some(upvar_field) = self - .prefixes(original_path.as_ref(), PrefixSet::All) - .find_map(|p| self.is_upvar_field_projection(p)) + if let Some(upvar_field) = self + .prefixes(original_path.as_ref(), PrefixSet::All) + .find_map(|p| self.is_upvar_field_projection(p)) { + // Look for the introduction of the original binding being moved. let upvar = &self.upvars[upvar_field.index()]; let upvar_hir_id = upvar.get_root_variable(); use_span = match self.infcx.tcx.parent_hir_node(upvar_hir_id) { |
