From 5f7436b5fd27e534b2800389067b169cbe7864b7 Mon Sep 17 00:00:00 2001 From: Aaron Hill Date: Sat, 8 Aug 2020 13:16:43 -0400 Subject: [PATCH] Be consistent when describing a move as a 'partial' in diagnostics When an error occurs due to a partial move, we would use the world "partial" in some parts of the error message, but not in others. This commit ensures that we use the word 'partial' in either all or none of the diagnostic messages. Additionally, we no longer describe a move out of a `Box` via `*` as a 'partial move'. This was a pre-existing issue, but became more noticable when the word 'partial' is used in more places. --- .../diagnostics/conflict_errors.rs | 77 ++++++++++++++----- .../borrow_check/diagnostics/mod.rs | 5 +- .../borrow_check/diagnostics/move_errors.rs | 11 ++- .../issue-66958-non-copy-infered-type-arg.rs | 2 +- ...sue-66958-non-copy-infered-type-arg.stderr | 6 +- .../binding/issue-53114-borrow-checks.stderr | 24 +++--- .../borrowck-move-out-from-array-match.rs | 12 +-- .../borrowck-move-out-from-array-match.stderr | 36 ++++----- ...ck-move-out-from-array-no-overlap-match.rs | 18 ++--- ...ove-out-from-array-no-overlap-match.stderr | 54 ++++++------- ...rowck-move-out-from-array-use-match.stderr | 60 +++++++-------- ...ove-out-from-array-use-no-overlap-match.rs | 18 ++--- ...out-from-array-use-no-overlap-match.stderr | 54 ++++++------- .../borrowck-move-out-from-array-use.stderr | 60 +++++++-------- .../borrowck-move-out-from-array.stderr | 36 ++++----- .../borrowck-uninit-field-access.stderr | 6 +- src/test/ui/borrowck/move-in-pattern-mut.rs | 4 +- .../ui/borrowck/move-in-pattern-mut.stderr | 12 +-- src/test/ui/borrowck/move-in-pattern.fixed | 4 +- src/test/ui/borrowck/move-in-pattern.rs | 4 +- src/test/ui/borrowck/move-in-pattern.stderr | 12 +-- ...s-based-on-type-cyclic-types-issue-4821.rs | 2 +- ...sed-on-type-cyclic-types-issue-4821.stderr | 6 +- .../moves-based-on-type-match-bindings.rs | 4 +- .../moves-based-on-type-match-bindings.stderr | 6 +- src/test/ui/nll/move-subpaths-moves-root.rs | 2 +- .../ui/nll/move-subpaths-moves-root.stderr | 6 +- src/test/ui/ref-suggestion.rs | 2 +- src/test/ui/ref-suggestion.stderr | 6 +- .../unsized-locals/borrow-after-move.stderr | 4 +- src/test/ui/unsized-locals/double-move.stderr | 4 +- 31 files changed, 300 insertions(+), 257 deletions(-) diff --git a/src/librustc_mir/borrow_check/diagnostics/conflict_errors.rs b/src/librustc_mir/borrow_check/diagnostics/conflict_errors.rs index 8e7c97c4a1ba..1f4bebadefbd 100644 --- a/src/librustc_mir/borrow_check/diagnostics/conflict_errors.rs +++ b/src/librustc_mir/borrow_check/diagnostics/conflict_errors.rs @@ -113,23 +113,32 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> { } } - let msg = ""; //FIXME: add "partially " or "collaterally " + let is_partial_move = move_site_vec.iter().any(|move_site| { + let move_out = self.move_data.moves[(*move_site).moi]; + let moved_place = &self.move_data.move_paths[move_out.path].place; + // `*(_1)` where `_1` is a `Box` is actually a move out. + let is_box_move = moved_place.as_ref().projection == &[ProjectionElem::Deref] + && self.body.local_decls[moved_place.local].ty.is_box(); + + !is_box_move + && used_place != moved_place.as_ref() + && used_place.is_prefix_of(moved_place.as_ref()) + }); + + let partial_str = if is_partial_move { "partial " } else { "" }; + let partially_str = if is_partial_move { "partially " } else { "" }; let mut err = self.cannot_act_on_moved_value( span, desired_action.as_noun(), - msg, + partially_str, self.describe_place_with_options(moved_place, IncludingDowncast(true)), ); self.add_moved_or_invoked_closure_note(location, used_place, &mut err); let mut is_loop_move = false; - let is_partial_move = move_site_vec.iter().any(|move_site| { - let move_out = self.move_data.moves[(*move_site).moi]; - let moved_place = &self.move_data.move_paths[move_out.path].place; - used_place != moved_place.as_ref() && used_place.is_prefix_of(moved_place.as_ref()) - }); + for move_site in &move_site_vec { let move_out = self.move_data.moves[(*move_site).moi]; let moved_place = &self.move_data.move_paths[move_out.path].place; @@ -142,13 +151,19 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> { if location == move_out.source { err.span_label( span, - format!("value moved{} here, in previous iteration of loop", move_msg), + format!( + "value {}moved{} here, in previous iteration of loop", + partially_str, move_msg + ), ); is_loop_move = true; } else if move_site.traversed_back_edge { err.span_label( move_span, - format!("value moved{} here, in previous iteration of loop", move_msg), + format!( + "value {}moved{} here, in previous iteration of loop", + partially_str, move_msg + ), ); } else { if let UseSpans::FnSelfUse { var_span, fn_call_span, fn_span, kind } = @@ -162,7 +177,10 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> { FnSelfUseKind::FnOnceCall => { err.span_label( fn_call_span, - &format!("{} moved due to this call", place_name), + &format!( + "{} {}moved due to this call", + place_name, partially_str + ), ); err.span_note( var_span, @@ -172,7 +190,10 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> { FnSelfUseKind::Operator { self_arg } => { err.span_label( fn_call_span, - &format!("{} moved due to usage in operator", place_name), + &format!( + "{} {}moved due to usage in operator", + place_name, partially_str + ), ); if self.fn_self_span_reported.insert(fn_span) { err.span_note( @@ -186,14 +207,17 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> { err.span_label( fn_call_span, &format!( - "{} moved due to this implicit call to `.into_iter()`", - place_name + "{} {}moved due to this implicit call to `.into_iter()`", + place_name, partially_str ), ); } else { err.span_label( fn_call_span, - &format!("{} moved due to this method call", place_name), + &format!( + "{} {}moved due to this method call", + place_name, partially_str + ), ); } // Avoid pointing to the same function in multiple different @@ -207,10 +231,17 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> { } } } else { - err.span_label(move_span, format!("value moved{} here", move_msg)); + err.span_label( + move_span, + format!("value {}moved{} here", partially_str, move_msg), + ); move_spans.var_span_label( &mut err, - format!("variable moved due to use{}", move_spans.describe()), + format!( + "variable {}moved due to use{}", + partially_str, + move_spans.describe() + ), ); } } @@ -250,9 +281,9 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> { err.span_label( span, format!( - "value {} here {}", + "value {} here after {}move", desired_action.as_verb_in_past_tense(), - if is_partial_move { "after partial move" } else { "after move" }, + partial_str ), ); } @@ -321,7 +352,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> { } else { None }; - self.note_type_does_not_implement_copy(&mut err, ¬e_msg, ty, span); + self.note_type_does_not_implement_copy(&mut err, ¬e_msg, ty, span, partial_str); } if let Some((_, mut old_err)) = @@ -1398,8 +1429,12 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> { for moi in &self.move_data.loc_map[location] { debug!("report_use_of_moved_or_uninitialized: moi={:?}", moi); - if mpis.contains(&self.move_data.moves[*moi].path) { - debug!("report_use_of_moved_or_uninitialized: found"); + let path = self.move_data.moves[*moi].path; + if mpis.contains(&path) { + debug!( + "report_use_of_moved_or_uninitialized: found {:?}", + move_paths[path].place + ); result.push(MoveSite { moi: *moi, traversed_back_edge: is_back_edge }); // Strictly speaking, we could continue our DFS here. There may be diff --git a/src/librustc_mir/borrow_check/diagnostics/mod.rs b/src/librustc_mir/borrow_check/diagnostics/mod.rs index ba74ffaa8d62..79e8b000f3eb 100644 --- a/src/librustc_mir/borrow_check/diagnostics/mod.rs +++ b/src/librustc_mir/borrow_check/diagnostics/mod.rs @@ -412,10 +412,11 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> { place_desc: &str, ty: Ty<'tcx>, span: Option, + move_prefix: &str, ) { let message = format!( - "move occurs because {} has type `{}`, which does not implement the `Copy` trait", - place_desc, ty, + "{}move occurs because {} has type `{}`, which does not implement the `Copy` trait", + move_prefix, place_desc, ty, ); if let Some(span) = span { err.span_label(span, message); diff --git a/src/librustc_mir/borrow_check/diagnostics/move_errors.rs b/src/librustc_mir/borrow_check/diagnostics/move_errors.rs index bd3e20458b07..1c8da212f108 100644 --- a/src/librustc_mir/borrow_check/diagnostics/move_errors.rs +++ b/src/librustc_mir/borrow_check/diagnostics/move_errors.rs @@ -445,7 +445,13 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> { None => "value".to_string(), }; - self.note_type_does_not_implement_copy(err, &place_desc, place_ty, Some(span)); + self.note_type_does_not_implement_copy( + err, + &place_desc, + place_ty, + Some(span), + "", + ); } else { binds_to.sort(); binds_to.dedup(); @@ -467,7 +473,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> { Some(desc) => format!("`{}`", desc), None => "value".to_string(), }; - self.note_type_does_not_implement_copy(err, &place_desc, place_ty, Some(span)); + self.note_type_does_not_implement_copy(err, &place_desc, place_ty, Some(span), ""); use_spans.args_span_label(err, format!("move out of {} occurs here", place_desc)); use_spans @@ -529,6 +535,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> { &format!("`{}`", self.local_names[*local].unwrap()), bind_to.ty, Some(binding_span), + "", ); } } diff --git a/src/test/ui/async-await/issues/issue-66958-non-copy-infered-type-arg.rs b/src/test/ui/async-await/issues/issue-66958-non-copy-infered-type-arg.rs index c8c2702ec447..b7a976a0af69 100644 --- a/src/test/ui/async-await/issues/issue-66958-non-copy-infered-type-arg.rs +++ b/src/test/ui/async-await/issues/issue-66958-non-copy-infered-type-arg.rs @@ -8,7 +8,7 @@ impl Ia { async fn crash(self) { Self::partial(self.0); - Self::full(self); //~ ERROR use of moved value: `self` + Self::full(self); //~ ERROR use of partially moved value: `self` } } diff --git a/src/test/ui/async-await/issues/issue-66958-non-copy-infered-type-arg.stderr b/src/test/ui/async-await/issues/issue-66958-non-copy-infered-type-arg.stderr index 9177b83dd48d..e2a73539874e 100644 --- a/src/test/ui/async-await/issues/issue-66958-non-copy-infered-type-arg.stderr +++ b/src/test/ui/async-await/issues/issue-66958-non-copy-infered-type-arg.stderr @@ -1,12 +1,12 @@ -error[E0382]: use of moved value: `self` +error[E0382]: use of partially moved value: `self` --> $DIR/issue-66958-non-copy-infered-type-arg.rs:11:20 | LL | Self::partial(self.0); - | ------ value moved here + | ------ value partially moved here LL | Self::full(self); | ^^^^ value used here after partial move | - = note: move occurs because `self.0` has type `S`, which does not implement the `Copy` trait + = note: partial move occurs because `self.0` has type `S`, which does not implement the `Copy` trait error: aborting due to previous error diff --git a/src/test/ui/binding/issue-53114-borrow-checks.stderr b/src/test/ui/binding/issue-53114-borrow-checks.stderr index 2a7a721324d6..489bf70d920a 100644 --- a/src/test/ui/binding/issue-53114-borrow-checks.stderr +++ b/src/test/ui/binding/issue-53114-borrow-checks.stderr @@ -8,26 +8,26 @@ LL | drop(m); LL | match m { _ => { } } // #53114: should eventually be accepted too | ^ value used here after move -error[E0382]: use of moved value: `mm` +error[E0382]: use of partially moved value: `mm` --> $DIR/issue-53114-borrow-checks.rs:27:11 | LL | match mm { (_x, _) => { } } - | -- value moved here + | -- value partially moved here LL | match mm { (_, _y) => { } } | ^^ value used here after partial move | - = note: move occurs because `mm.0` has type `M`, which does not implement the `Copy` trait + = note: partial move occurs because `mm.0` has type `M`, which does not implement the `Copy` trait -error[E0382]: use of moved value: `mm` +error[E0382]: use of partially moved value: `mm` --> $DIR/issue-53114-borrow-checks.rs:29:11 | LL | match mm { (_, _y) => { } } - | -- value moved here + | -- value partially moved here LL | LL | match mm { (_, _) => { } } | ^^ value used here after partial move | - = note: move occurs because `mm.1` has type `M`, which does not implement the `Copy` trait + = note: partial move occurs because `mm.1` has type `M`, which does not implement the `Copy` trait error[E0382]: use of moved value: `m` --> $DIR/issue-53114-borrow-checks.rs:36:16 @@ -39,26 +39,26 @@ LL | drop(m); LL | if let _ = m { } // #53114: should eventually be accepted too | ^ value used here after move -error[E0382]: use of moved value: `mm` +error[E0382]: use of partially moved value: `mm` --> $DIR/issue-53114-borrow-checks.rs:41:22 | LL | if let (_x, _) = mm { } - | -- value moved here + | -- value partially moved here LL | if let (_, _y) = mm { } | ^^ value used here after partial move | - = note: move occurs because `mm.0` has type `M`, which does not implement the `Copy` trait + = note: partial move occurs because `mm.0` has type `M`, which does not implement the `Copy` trait -error[E0382]: use of moved value: `mm` +error[E0382]: use of partially moved value: `mm` --> $DIR/issue-53114-borrow-checks.rs:43:21 | LL | if let (_, _y) = mm { } - | -- value moved here + | -- value partially moved here LL | LL | if let (_, _) = mm { } | ^^ value used here after partial move | - = note: move occurs because `mm.1` has type `M`, which does not implement the `Copy` trait + = note: partial move occurs because `mm.1` has type `M`, which does not implement the `Copy` trait error: aborting due to 6 previous errors diff --git a/src/test/ui/borrowck/borrowck-move-out-from-array-match.rs b/src/test/ui/borrowck/borrowck-move-out-from-array-match.rs index c1513fcba8a6..ced4d002b384 100644 --- a/src/test/ui/borrowck/borrowck-move-out-from-array-match.rs +++ b/src/test/ui/borrowck/borrowck-move-out-from-array-match.rs @@ -20,7 +20,7 @@ fn move_out_from_begin_field_and_end() { [_, _, (_x, _)] => {} } match a { - [.., _y] => {} //~ ERROR use of moved value + [.., _y] => {} //~ ERROR use of partially moved value } } @@ -42,7 +42,7 @@ fn move_out_by_const_index_and_subslice() { [_x, _, _] => {} } match a { - //~^ ERROR use of moved value + //~^ ERROR use of partially moved value [_y @ .., _, _] => {} } } @@ -53,7 +53,7 @@ fn move_out_by_const_index_end_and_subslice() { [.., _x] => {} } match a { - //~^ ERROR use of moved value + //~^ ERROR use of partially moved value [_, _, _y @ ..] => {} } } @@ -64,7 +64,7 @@ fn move_out_by_const_index_field_and_subslice() { [(_x, _), _, _] => {} } match a { - //~^ ERROR use of moved value + //~^ ERROR use of partially moved value [_y @ .., _, _] => {} } } @@ -75,7 +75,7 @@ fn move_out_by_const_index_end_field_and_subslice() { [.., (_x, _)] => {} } match a { - //~^ ERROR use of moved value + //~^ ERROR use of partially moved value [_, _, _y @ ..] => {} } } @@ -108,7 +108,7 @@ fn move_out_by_subslice_and_subslice() { [x @ .., _] => {} } match a { - //~^ ERROR use of moved value + //~^ ERROR use of partially moved value [_, _y @ ..] => {} } } diff --git a/src/test/ui/borrowck/borrowck-move-out-from-array-match.stderr b/src/test/ui/borrowck/borrowck-move-out-from-array-match.stderr index 84930b000ccb..d63f03a71dbf 100644 --- a/src/test/ui/borrowck/borrowck-move-out-from-array-match.stderr +++ b/src/test/ui/borrowck/borrowck-move-out-from-array-match.stderr @@ -9,16 +9,16 @@ LL | [.., _y] => {} | = note: move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait -error[E0382]: use of moved value: `a[..]` +error[E0382]: use of partially moved value: `a[..]` --> $DIR/borrowck-move-out-from-array-match.rs:23:14 | LL | [_, _, (_x, _)] => {} - | -- value moved here + | -- value partially moved here ... LL | [.., _y] => {} | ^^ value used here after partial move | - = note: move occurs because `a[..].0` has type `std::string::String`, which does not implement the `Copy` trait + = note: partial move occurs because `a[..].0` has type `std::string::String`, which does not implement the `Copy` trait error[E0382]: use of moved value: `a[..].0` --> $DIR/borrowck-move-out-from-array-match.rs:33:15 @@ -31,49 +31,49 @@ LL | [.., (_y, _)] => {} | = note: move occurs because `a[..].0` has type `std::string::String`, which does not implement the `Copy` trait -error[E0382]: use of moved value: `a` +error[E0382]: use of partially moved value: `a` --> $DIR/borrowck-move-out-from-array-match.rs:44:11 | LL | [_x, _, _] => {} - | -- value moved here + | -- value partially moved here LL | } LL | match a { | ^ value used here after partial move | - = note: move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait + = note: partial move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait -error[E0382]: use of moved value: `a` +error[E0382]: use of partially moved value: `a` --> $DIR/borrowck-move-out-from-array-match.rs:55:11 | LL | [.., _x] => {} - | -- value moved here + | -- value partially moved here LL | } LL | match a { | ^ value used here after partial move | - = note: move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait + = note: partial move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait -error[E0382]: use of moved value: `a` +error[E0382]: use of partially moved value: `a` --> $DIR/borrowck-move-out-from-array-match.rs:66:11 | LL | [(_x, _), _, _] => {} - | -- value moved here + | -- value partially moved here LL | } LL | match a { | ^ value used here after partial move | - = note: move occurs because `a[..].0` has type `std::string::String`, which does not implement the `Copy` trait + = note: partial move occurs because `a[..].0` has type `std::string::String`, which does not implement the `Copy` trait -error[E0382]: use of moved value: `a` +error[E0382]: use of partially moved value: `a` --> $DIR/borrowck-move-out-from-array-match.rs:77:11 | LL | [.., (_x, _)] => {} - | -- value moved here + | -- value partially moved here LL | } LL | match a { | ^ value used here after partial move | - = note: move occurs because `a[..].0` has type `std::string::String`, which does not implement the `Copy` trait + = note: partial move occurs because `a[..].0` has type `std::string::String`, which does not implement the `Copy` trait error[E0382]: use of moved value: `a[..].0` --> $DIR/borrowck-move-out-from-array-match.rs:89:11 @@ -97,16 +97,16 @@ LL | [.., (_x, _)] => {} | = note: move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait -error[E0382]: use of moved value: `a` +error[E0382]: use of partially moved value: `a` --> $DIR/borrowck-move-out-from-array-match.rs:110:11 | LL | [x @ .., _] => {} - | ------ value moved here + | ------ value partially moved here LL | } LL | match a { | ^ value used here after partial move | - = note: move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait + = note: partial move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait error: aborting due to 10 previous errors diff --git a/src/test/ui/borrowck/borrowck-move-out-from-array-no-overlap-match.rs b/src/test/ui/borrowck/borrowck-move-out-from-array-no-overlap-match.rs index 056b8e672bd9..97db70f34cc7 100644 --- a/src/test/ui/borrowck/borrowck-move-out-from-array-no-overlap-match.rs +++ b/src/test/ui/borrowck/borrowck-move-out-from-array-no-overlap-match.rs @@ -15,7 +15,7 @@ fn move_out_from_begin_and_one_from_end() { [_, _, _x] => {} } match a { - //~^ ERROR use of moved value + //~^ ERROR use of partially moved value [.., _y, _] => {} } } @@ -26,7 +26,7 @@ fn move_out_from_begin_field_and_end_field() { [_, _, (_x, _)] => {} } match a { - //~^ ERROR use of moved value + //~^ ERROR use of partially moved value [.., (_, _y)] => {} } } @@ -39,7 +39,7 @@ fn move_out_by_const_index_and_subslice() { [_x, _, _] => {} } match a { - //~^ ERROR use of moved value + //~^ ERROR use of partially moved value [_, _y @ ..] => {} } } @@ -50,7 +50,7 @@ fn move_out_by_const_index_end_and_subslice() { [.., _x] => {} } match a { - //~^ ERROR use of moved value + //~^ ERROR use of partially moved value [_y @ .., _] => {} } } @@ -61,7 +61,7 @@ fn move_out_by_const_index_field_and_subslice() { [(_x, _), _, _] => {} } match a { - //~^ ERROR use of moved value + //~^ ERROR use of partially moved value [_, _y @ ..] => {} } } @@ -72,7 +72,7 @@ fn move_out_by_const_index_end_field_and_subslice() { [.., (_x, _)] => {} } match a { - //~^ ERROR use of moved value + //~^ ERROR use of partially moved value [_y @ .., _] => {} } } @@ -83,7 +83,7 @@ fn move_out_by_const_subslice_and_index_field() { [_, _y @ ..] => {} } match a { - //~^ ERROR use of moved value + //~^ ERROR use of partially moved value [(_x, _), _, _] => {} } } @@ -94,7 +94,7 @@ fn move_out_by_const_subslice_and_end_index_field() { [_y @ .., _] => {} } match a { - //~^ ERROR use of moved value + //~^ ERROR use of partially moved value [.., (_x, _)] => {} } } @@ -107,7 +107,7 @@ fn move_out_by_subslice_and_subslice() { [x @ .., _, _] => {} } match a { - //~^ ERROR use of moved value + //~^ ERROR use of partially moved value [_, _y @ ..] => {} } } diff --git a/src/test/ui/borrowck/borrowck-move-out-from-array-no-overlap-match.stderr b/src/test/ui/borrowck/borrowck-move-out-from-array-no-overlap-match.stderr index ff5eab2442c8..7c675149894a 100644 --- a/src/test/ui/borrowck/borrowck-move-out-from-array-no-overlap-match.stderr +++ b/src/test/ui/borrowck/borrowck-move-out-from-array-no-overlap-match.stderr @@ -1,101 +1,101 @@ -error[E0382]: use of moved value: `a` +error[E0382]: use of partially moved value: `a` --> $DIR/borrowck-move-out-from-array-no-overlap-match.rs:17:11 | LL | [_, _, _x] => {} - | -- value moved here + | -- value partially moved here LL | } LL | match a { | ^ value used here after partial move | - = note: move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait + = note: partial move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait -error[E0382]: use of moved value: `a` +error[E0382]: use of partially moved value: `a` --> $DIR/borrowck-move-out-from-array-no-overlap-match.rs:28:11 | LL | [_, _, (_x, _)] => {} - | -- value moved here + | -- value partially moved here LL | } LL | match a { | ^ value used here after partial move | - = note: move occurs because `a[..].0` has type `std::string::String`, which does not implement the `Copy` trait + = note: partial move occurs because `a[..].0` has type `std::string::String`, which does not implement the `Copy` trait -error[E0382]: use of moved value: `a` +error[E0382]: use of partially moved value: `a` --> $DIR/borrowck-move-out-from-array-no-overlap-match.rs:41:11 | LL | [_x, _, _] => {} - | -- value moved here + | -- value partially moved here LL | } LL | match a { | ^ value used here after partial move | - = note: move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait + = note: partial move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait -error[E0382]: use of moved value: `a` +error[E0382]: use of partially moved value: `a` --> $DIR/borrowck-move-out-from-array-no-overlap-match.rs:52:11 | LL | [.., _x] => {} - | -- value moved here + | -- value partially moved here LL | } LL | match a { | ^ value used here after partial move | - = note: move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait + = note: partial move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait -error[E0382]: use of moved value: `a` +error[E0382]: use of partially moved value: `a` --> $DIR/borrowck-move-out-from-array-no-overlap-match.rs:63:11 | LL | [(_x, _), _, _] => {} - | -- value moved here + | -- value partially moved here LL | } LL | match a { | ^ value used here after partial move | - = note: move occurs because `a[..].0` has type `std::string::String`, which does not implement the `Copy` trait + = note: partial move occurs because `a[..].0` has type `std::string::String`, which does not implement the `Copy` trait -error[E0382]: use of moved value: `a` +error[E0382]: use of partially moved value: `a` --> $DIR/borrowck-move-out-from-array-no-overlap-match.rs:74:11 | LL | [.., (_x, _)] => {} - | -- value moved here + | -- value partially moved here LL | } LL | match a { | ^ value used here after partial move | - = note: move occurs because `a[..].0` has type `std::string::String`, which does not implement the `Copy` trait + = note: partial move occurs because `a[..].0` has type `std::string::String`, which does not implement the `Copy` trait -error[E0382]: use of moved value: `a` +error[E0382]: use of partially moved value: `a` --> $DIR/borrowck-move-out-from-array-no-overlap-match.rs:85:11 | LL | [_, _y @ ..] => {} - | ------- value moved here + | ------- value partially moved here LL | } LL | match a { | ^ value used here after partial move | - = note: move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait + = note: partial move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait -error[E0382]: use of moved value: `a` +error[E0382]: use of partially moved value: `a` --> $DIR/borrowck-move-out-from-array-no-overlap-match.rs:96:11 | LL | [_y @ .., _] => {} - | ------- value moved here + | ------- value partially moved here LL | } LL | match a { | ^ value used here after partial move | - = note: move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait + = note: partial move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait -error[E0382]: use of moved value: `a` +error[E0382]: use of partially moved value: `a` --> $DIR/borrowck-move-out-from-array-no-overlap-match.rs:109:11 | LL | [x @ .., _, _] => {} - | ------ value moved here + | ------ value partially moved here LL | } LL | match a { | ^ value used here after partial move | - = note: move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait + = note: partial move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait error: aborting due to 9 previous errors diff --git a/src/test/ui/borrowck/borrowck-move-out-from-array-use-match.stderr b/src/test/ui/borrowck/borrowck-move-out-from-array-use-match.stderr index 0ef63105cfbd..806354b0116c 100644 --- a/src/test/ui/borrowck/borrowck-move-out-from-array-use-match.stderr +++ b/src/test/ui/borrowck/borrowck-move-out-from-array-use-match.stderr @@ -9,16 +9,16 @@ LL | [.., ref _y] => {} | = note: move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait -error[E0382]: borrow of moved value: `a[..]` +error[E0382]: borrow of partially moved value: `a[..]` --> $DIR/borrowck-move-out-from-array-use-match.rs:23:14 | LL | [_, _, (_x, _)] => {} - | -- value moved here + | -- value partially moved here ... LL | [.., ref _y] => {} | ^^^^^^ value borrowed here after partial move | - = note: move occurs because `a[..].0` has type `std::string::String`, which does not implement the `Copy` trait + = note: partial move occurs because `a[..].0` has type `std::string::String`, which does not implement the `Copy` trait error[E0382]: borrow of moved value: `a[..].0` --> $DIR/borrowck-move-out-from-array-use-match.rs:33:15 @@ -31,49 +31,49 @@ LL | [.., (ref _y, _)] => {} | = note: move occurs because `a[..].0` has type `std::string::String`, which does not implement the `Copy` trait -error[E0382]: use of moved value: `a` +error[E0382]: use of partially moved value: `a` --> $DIR/borrowck-move-out-from-array-use-match.rs:44:11 | LL | [_x, _, _] => {} - | -- value moved here + | -- value partially moved here LL | } LL | match a { | ^ value used here after partial move | - = note: move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait + = note: partial move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait -error[E0382]: use of moved value: `a` +error[E0382]: use of partially moved value: `a` --> $DIR/borrowck-move-out-from-array-use-match.rs:55:11 | LL | [.., _x] => {} - | -- value moved here + | -- value partially moved here LL | } LL | match a { | ^ value used here after partial move | - = note: move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait + = note: partial move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait -error[E0382]: use of moved value: `a` +error[E0382]: use of partially moved value: `a` --> $DIR/borrowck-move-out-from-array-use-match.rs:66:11 | LL | [(_x, _), _, _] => {} - | -- value moved here + | -- value partially moved here LL | } LL | match a { | ^ value used here after partial move | - = note: move occurs because `a[..].0` has type `std::string::String`, which does not implement the `Copy` trait + = note: partial move occurs because `a[..].0` has type `std::string::String`, which does not implement the `Copy` trait -error[E0382]: use of moved value: `a` +error[E0382]: use of partially moved value: `a` --> $DIR/borrowck-move-out-from-array-use-match.rs:77:11 | LL | [.., (_x, _)] => {} - | -- value moved here + | -- value partially moved here LL | } LL | match a { | ^ value used here after partial move | - = note: move occurs because `a[..].0` has type `std::string::String`, which does not implement the `Copy` trait + = note: partial move occurs because `a[..].0` has type `std::string::String`, which does not implement the `Copy` trait error[E0382]: borrow of moved value: `a[..]` --> $DIR/borrowck-move-out-from-array-use-match.rs:89:11 @@ -97,60 +97,60 @@ LL | [.., (ref _x, _)] => {} | = note: move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait -error[E0382]: use of moved value: `a` +error[E0382]: use of partially moved value: `a` --> $DIR/borrowck-move-out-from-array-use-match.rs:110:11 | LL | [x @ .., _] => {} - | ------ value moved here + | ------ value partially moved here LL | } LL | match a { | ^ value used here after partial move | - = note: move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait + = note: partial move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait -error[E0382]: use of moved value: `a` +error[E0382]: use of partially moved value: `a` --> $DIR/borrowck-move-out-from-array-use-match.rs:123:5 | LL | [_, _, _x] => {} - | -- value moved here + | -- value partially moved here LL | } LL | a[2] = Default::default(); | ^^^^ value used here after partial move | - = note: move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait + = note: partial move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait -error[E0382]: use of moved value: `a` +error[E0382]: use of partially moved value: `a` --> $DIR/borrowck-move-out-from-array-use-match.rs:131:5 | LL | [_, _, (_x, _)] => {} - | -- value moved here + | -- value partially moved here LL | } LL | a[2].1 = Default::default(); | ^^^^ value used here after partial move | - = note: move occurs because `a[..].0` has type `std::string::String`, which does not implement the `Copy` trait + = note: partial move occurs because `a[..].0` has type `std::string::String`, which does not implement the `Copy` trait -error[E0382]: use of moved value: `a` +error[E0382]: use of partially moved value: `a` --> $DIR/borrowck-move-out-from-array-use-match.rs:139:5 | LL | [_, _, _x @ ..] => {} - | ------- value moved here + | ------- value partially moved here LL | } LL | a[0] = Default::default(); | ^^^^ value used here after partial move | - = note: move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait + = note: partial move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait -error[E0382]: use of moved value: `a` +error[E0382]: use of partially moved value: `a` --> $DIR/borrowck-move-out-from-array-use-match.rs:147:5 | LL | [_, _, _x @ ..] => {} - | ------- value moved here + | ------- value partially moved here LL | } LL | a[0].1 = Default::default(); | ^^^^ value used here after partial move | - = note: move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait + = note: partial move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait error: aborting due to 14 previous errors diff --git a/src/test/ui/borrowck/borrowck-move-out-from-array-use-no-overlap-match.rs b/src/test/ui/borrowck/borrowck-move-out-from-array-use-no-overlap-match.rs index 5afd6835dcfb..017ca90b81a3 100644 --- a/src/test/ui/borrowck/borrowck-move-out-from-array-use-no-overlap-match.rs +++ b/src/test/ui/borrowck/borrowck-move-out-from-array-use-no-overlap-match.rs @@ -15,7 +15,7 @@ fn move_out_from_begin_and_one_from_end() { [_, _, _x] => {} } match a { - //~^ ERROR use of moved value + //~^ ERROR use of partially moved value [.., ref _y, _] => {} } } @@ -26,7 +26,7 @@ fn move_out_from_begin_field_and_end_field() { [_, _, (_x, _)] => {} } match a { - //~^ ERROR use of moved value + //~^ ERROR use of partially moved value [.., (_, ref _y)] => {} } } @@ -39,7 +39,7 @@ fn move_out_by_const_index_and_subslice() { [_x, _, _] => {} } match a { - //~^ ERROR use of moved value + //~^ ERROR use of partially moved value [_, ref _y @ ..] => {} } } @@ -50,7 +50,7 @@ fn move_out_by_const_index_end_and_subslice() { [.., _x] => {} } match a { - //~^ ERROR use of moved value + //~^ ERROR use of partially moved value [ref _y @ .., _] => {} } } @@ -61,7 +61,7 @@ fn move_out_by_const_index_field_and_subslice() { [(_x, _), _, _] => {} } match a { - //~^ ERROR use of moved value + //~^ ERROR use of partially moved value [_, ref _y @ ..] => {} } } @@ -72,7 +72,7 @@ fn move_out_by_const_index_end_field_and_subslice() { [.., (_x, _)] => {} } match a { - //~^ ERROR use of moved value + //~^ ERROR use of partially moved value [ref _y @ .., _] => {} } } @@ -83,7 +83,7 @@ fn move_out_by_const_subslice_and_index_field() { [_, _y @ ..] => {} } match a { - //~^ ERROR use of moved value + //~^ ERROR use of partially moved value [(ref _x, _), _, _] => {} } } @@ -94,7 +94,7 @@ fn move_out_by_const_subslice_and_end_index_field() { [_y @ .., _] => {} } match a { - //~^ ERROR use of moved value + //~^ ERROR use of partially moved value [.., (ref _x, _)] => {} } } @@ -107,7 +107,7 @@ fn move_out_by_subslice_and_subslice() { [x @ .., _, _] => {} } match a { - //~^ ERROR use of moved value + //~^ ERROR use of partially moved value [_, ref _y @ ..] => {} } } diff --git a/src/test/ui/borrowck/borrowck-move-out-from-array-use-no-overlap-match.stderr b/src/test/ui/borrowck/borrowck-move-out-from-array-use-no-overlap-match.stderr index a4042ce7db33..53f815db140d 100644 --- a/src/test/ui/borrowck/borrowck-move-out-from-array-use-no-overlap-match.stderr +++ b/src/test/ui/borrowck/borrowck-move-out-from-array-use-no-overlap-match.stderr @@ -1,101 +1,101 @@ -error[E0382]: use of moved value: `a` +error[E0382]: use of partially moved value: `a` --> $DIR/borrowck-move-out-from-array-use-no-overlap-match.rs:17:11 | LL | [_, _, _x] => {} - | -- value moved here + | -- value partially moved here LL | } LL | match a { | ^ value used here after partial move | - = note: move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait + = note: partial move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait -error[E0382]: use of moved value: `a` +error[E0382]: use of partially moved value: `a` --> $DIR/borrowck-move-out-from-array-use-no-overlap-match.rs:28:11 | LL | [_, _, (_x, _)] => {} - | -- value moved here + | -- value partially moved here LL | } LL | match a { | ^ value used here after partial move | - = note: move occurs because `a[..].0` has type `std::string::String`, which does not implement the `Copy` trait + = note: partial move occurs because `a[..].0` has type `std::string::String`, which does not implement the `Copy` trait -error[E0382]: use of moved value: `a` +error[E0382]: use of partially moved value: `a` --> $DIR/borrowck-move-out-from-array-use-no-overlap-match.rs:41:11 | LL | [_x, _, _] => {} - | -- value moved here + | -- value partially moved here LL | } LL | match a { | ^ value used here after partial move | - = note: move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait + = note: partial move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait -error[E0382]: use of moved value: `a` +error[E0382]: use of partially moved value: `a` --> $DIR/borrowck-move-out-from-array-use-no-overlap-match.rs:52:11 | LL | [.., _x] => {} - | -- value moved here + | -- value partially moved here LL | } LL | match a { | ^ value used here after partial move | - = note: move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait + = note: partial move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait -error[E0382]: use of moved value: `a` +error[E0382]: use of partially moved value: `a` --> $DIR/borrowck-move-out-from-array-use-no-overlap-match.rs:63:11 | LL | [(_x, _), _, _] => {} - | -- value moved here + | -- value partially moved here LL | } LL | match a { | ^ value used here after partial move | - = note: move occurs because `a[..].0` has type `std::string::String`, which does not implement the `Copy` trait + = note: partial move occurs because `a[..].0` has type `std::string::String`, which does not implement the `Copy` trait -error[E0382]: use of moved value: `a` +error[E0382]: use of partially moved value: `a` --> $DIR/borrowck-move-out-from-array-use-no-overlap-match.rs:74:11 | LL | [.., (_x, _)] => {} - | -- value moved here + | -- value partially moved here LL | } LL | match a { | ^ value used here after partial move | - = note: move occurs because `a[..].0` has type `std::string::String`, which does not implement the `Copy` trait + = note: partial move occurs because `a[..].0` has type `std::string::String`, which does not implement the `Copy` trait -error[E0382]: use of moved value: `a` +error[E0382]: use of partially moved value: `a` --> $DIR/borrowck-move-out-from-array-use-no-overlap-match.rs:85:11 | LL | [_, _y @ ..] => {} - | ------- value moved here + | ------- value partially moved here LL | } LL | match a { | ^ value used here after partial move | - = note: move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait + = note: partial move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait -error[E0382]: use of moved value: `a` +error[E0382]: use of partially moved value: `a` --> $DIR/borrowck-move-out-from-array-use-no-overlap-match.rs:96:11 | LL | [_y @ .., _] => {} - | ------- value moved here + | ------- value partially moved here LL | } LL | match a { | ^ value used here after partial move | - = note: move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait + = note: partial move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait -error[E0382]: use of moved value: `a` +error[E0382]: use of partially moved value: `a` --> $DIR/borrowck-move-out-from-array-use-no-overlap-match.rs:109:11 | LL | [x @ .., _, _] => {} - | ------ value moved here + | ------ value partially moved here LL | } LL | match a { | ^ value used here after partial move | - = note: move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait + = note: partial move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait error: aborting due to 9 previous errors diff --git a/src/test/ui/borrowck/borrowck-move-out-from-array-use.stderr b/src/test/ui/borrowck/borrowck-move-out-from-array-use.stderr index 7ad4116645e9..004cc433b345 100644 --- a/src/test/ui/borrowck/borrowck-move-out-from-array-use.stderr +++ b/src/test/ui/borrowck/borrowck-move-out-from-array-use.stderr @@ -8,15 +8,15 @@ LL | let [.., ref _y] = a; | = note: move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait -error[E0382]: borrow of moved value: `a[..]` +error[E0382]: borrow of partially moved value: `a[..]` --> $DIR/borrowck-move-out-from-array-use.rs:16:14 | LL | let [_, _, (_x, _)] = a; - | -- value moved here + | -- value partially moved here LL | let [.., ref _y] = a; | ^^^^^^ value borrowed here after partial move | - = note: move occurs because `a[..].0` has type `std::string::String`, which does not implement the `Copy` trait + = note: partial move occurs because `a[..].0` has type `std::string::String`, which does not implement the `Copy` trait error[E0382]: borrow of moved value: `a[..].0` --> $DIR/borrowck-move-out-from-array-use.rs:22:15 @@ -28,45 +28,45 @@ LL | let [.., (ref _y, _)] = a; | = note: move occurs because `a[..].0` has type `std::string::String`, which does not implement the `Copy` trait -error[E0382]: borrow of moved value: `a` +error[E0382]: borrow of partially moved value: `a` --> $DIR/borrowck-move-out-from-array-use.rs:30:10 | LL | let [_x, _, _] = a; - | -- value moved here + | -- value partially moved here LL | let [ref _y @ .., _, _] = a; | ^^^^^^^^^^^ value borrowed here after partial move | - = note: move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait + = note: partial move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait -error[E0382]: borrow of moved value: `a` +error[E0382]: borrow of partially moved value: `a` --> $DIR/borrowck-move-out-from-array-use.rs:36:16 | LL | let [.., _x] = a; - | -- value moved here + | -- value partially moved here LL | let [_, _, ref _y @ ..] = a; | ^^^^^^^^^^^ value borrowed here after partial move | - = note: move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait + = note: partial move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait -error[E0382]: borrow of moved value: `a` +error[E0382]: borrow of partially moved value: `a` --> $DIR/borrowck-move-out-from-array-use.rs:42:10 | LL | let [(_x, _), _, _] = a; - | -- value moved here + | -- value partially moved here LL | let [ref _y @ .., _, _] = a; | ^^^^^^^^^^^ value borrowed here after partial move | - = note: move occurs because `a[..].0` has type `std::string::String`, which does not implement the `Copy` trait + = note: partial move occurs because `a[..].0` has type `std::string::String`, which does not implement the `Copy` trait -error[E0382]: borrow of moved value: `a` +error[E0382]: borrow of partially moved value: `a` --> $DIR/borrowck-move-out-from-array-use.rs:48:16 | LL | let [.., (_x, _)] = a; - | -- value moved here + | -- value partially moved here LL | let [_, _, ref _y @ ..] = a; | ^^^^^^^^^^^ value borrowed here after partial move | - = note: move occurs because `a[..].0` has type `std::string::String`, which does not implement the `Copy` trait + = note: partial move occurs because `a[..].0` has type `std::string::String`, which does not implement the `Copy` trait error[E0382]: borrow of moved value: `a[..]` --> $DIR/borrowck-move-out-from-array-use.rs:54:11 @@ -88,55 +88,55 @@ LL | let [.., (ref _x, _)] = a; | = note: move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait -error[E0382]: borrow of moved value: `a` +error[E0382]: borrow of partially moved value: `a` --> $DIR/borrowck-move-out-from-array-use.rs:68:13 | LL | let [x @ .., _] = a; - | ------ value moved here + | ------ value partially moved here LL | let [_, ref _y @ ..] = a; | ^^^^^^^^^^^ value borrowed here after partial move | - = note: move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait + = note: partial move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait -error[E0382]: use of moved value: `a` +error[E0382]: use of partially moved value: `a` --> $DIR/borrowck-move-out-from-array-use.rs:76:5 | LL | let [_, _, _x] = a; - | -- value moved here + | -- value partially moved here LL | a[2] = Default::default(); | ^^^^ value used here after partial move | - = note: move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait + = note: partial move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait -error[E0382]: use of moved value: `a` +error[E0382]: use of partially moved value: `a` --> $DIR/borrowck-move-out-from-array-use.rs:82:5 | LL | let [_, _, (_x, _)] = a; - | -- value moved here + | -- value partially moved here LL | a[2].1 = Default::default(); | ^^^^ value used here after partial move | - = note: move occurs because `a[..].0` has type `std::string::String`, which does not implement the `Copy` trait + = note: partial move occurs because `a[..].0` has type `std::string::String`, which does not implement the `Copy` trait -error[E0382]: use of moved value: `a` +error[E0382]: use of partially moved value: `a` --> $DIR/borrowck-move-out-from-array-use.rs:88:5 | LL | let [_, _, _x @ ..] = a; - | ------- value moved here + | ------- value partially moved here LL | a[0] = Default::default(); | ^^^^ value used here after partial move | - = note: move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait + = note: partial move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait -error[E0382]: use of moved value: `a` +error[E0382]: use of partially moved value: `a` --> $DIR/borrowck-move-out-from-array-use.rs:94:5 | LL | let [_, _, _x @ ..] = a; - | ------- value moved here + | ------- value partially moved here LL | a[0].1 = Default::default(); | ^^^^ value used here after partial move | - = note: move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait + = note: partial move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait error: aborting due to 14 previous errors diff --git a/src/test/ui/borrowck/borrowck-move-out-from-array.stderr b/src/test/ui/borrowck/borrowck-move-out-from-array.stderr index b7babd93ed7a..d3eb3e9f7614 100644 --- a/src/test/ui/borrowck/borrowck-move-out-from-array.stderr +++ b/src/test/ui/borrowck/borrowck-move-out-from-array.stderr @@ -8,15 +8,15 @@ LL | let [.., _y] = a; | = note: move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait -error[E0382]: use of moved value: `a[..]` +error[E0382]: use of partially moved value: `a[..]` --> $DIR/borrowck-move-out-from-array.rs:16:14 | LL | let [_, _, (_x, _)] = a; - | -- value moved here + | -- value partially moved here LL | let [.., _y] = a; | ^^ value used here after partial move | - = note: move occurs because `a[..].0` has type `std::string::String`, which does not implement the `Copy` trait + = note: partial move occurs because `a[..].0` has type `std::string::String`, which does not implement the `Copy` trait error[E0382]: use of moved value: `a[..].0` --> $DIR/borrowck-move-out-from-array.rs:22:15 @@ -28,45 +28,45 @@ LL | let [.., (_y, _)] = a; | = note: move occurs because `a[..].0` has type `std::string::String`, which does not implement the `Copy` trait -error[E0382]: use of moved value: `a` +error[E0382]: use of partially moved value: `a` --> $DIR/borrowck-move-out-from-array.rs:30:10 | LL | let [_x, _, _] = a; - | -- value moved here + | -- value partially moved here LL | let [_y @ .., _, _] = a; | ^^^^^^^ value used here after partial move | - = note: move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait + = note: partial move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait -error[E0382]: use of moved value: `a` +error[E0382]: use of partially moved value: `a` --> $DIR/borrowck-move-out-from-array.rs:36:16 | LL | let [.., _x] = a; - | -- value moved here + | -- value partially moved here LL | let [_, _, _y @ ..] = a; | ^^^^^^^ value used here after partial move | - = note: move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait + = note: partial move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait -error[E0382]: use of moved value: `a` +error[E0382]: use of partially moved value: `a` --> $DIR/borrowck-move-out-from-array.rs:42:10 | LL | let [(_x, _), _, _] = a; - | -- value moved here + | -- value partially moved here LL | let [_y @ .., _, _] = a; | ^^^^^^^ value used here after partial move | - = note: move occurs because `a[..].0` has type `std::string::String`, which does not implement the `Copy` trait + = note: partial move occurs because `a[..].0` has type `std::string::String`, which does not implement the `Copy` trait -error[E0382]: use of moved value: `a` +error[E0382]: use of partially moved value: `a` --> $DIR/borrowck-move-out-from-array.rs:48:16 | LL | let [.., (_x, _)] = a; - | -- value moved here + | -- value partially moved here LL | let [_, _, _y @ ..] = a; | ^^^^^^^ value used here after partial move | - = note: move occurs because `a[..].0` has type `std::string::String`, which does not implement the `Copy` trait + = note: partial move occurs because `a[..].0` has type `std::string::String`, which does not implement the `Copy` trait error[E0382]: use of moved value: `a[..].0` --> $DIR/borrowck-move-out-from-array.rs:54:11 @@ -88,15 +88,15 @@ LL | let [.., (_x, _)] = a; | = note: move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait -error[E0382]: use of moved value: `a` +error[E0382]: use of partially moved value: `a` --> $DIR/borrowck-move-out-from-array.rs:68:13 | LL | let [x @ .., _] = a; - | ------ value moved here + | ------ value partially moved here LL | let [_, _y @ ..] = a; | ^^^^^^^ value used here after partial move | - = note: move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait + = note: partial move occurs because `a[..]` has type `(std::string::String, std::string::String)`, which does not implement the `Copy` trait error: aborting due to 10 previous errors diff --git a/src/test/ui/borrowck/borrowck-uninit-field-access.stderr b/src/test/ui/borrowck/borrowck-uninit-field-access.stderr index 9f35a4a8d83b..7951a5b1b5d7 100644 --- a/src/test/ui/borrowck/borrowck-uninit-field-access.stderr +++ b/src/test/ui/borrowck/borrowck-uninit-field-access.stderr @@ -14,15 +14,15 @@ LL | let _ = line1.origin.x + 1; | = note: move occurs because `line1.origin` has type `Point`, which does not implement the `Copy` trait -error[E0382]: use of moved value: `line2` +error[E0382]: use of partially moved value: `line2` --> $DIR/borrowck-uninit-field-access.rs:29:5 | LL | let _moved = (line2.origin, line2.middle); - | ------------ value moved here + | ------------ value partially moved here LL | line2.consume(); | ^^^^^ value used here after partial move | - = note: move occurs because `line2.middle` has type `Point`, which does not implement the `Copy` trait + = note: partial move occurs because `line2.middle` has type `Point`, which does not implement the `Copy` trait error: aborting due to 3 previous errors diff --git a/src/test/ui/borrowck/move-in-pattern-mut.rs b/src/test/ui/borrowck/move-in-pattern-mut.rs index 175eb3b7a04d..b5c275bf28ca 100644 --- a/src/test/ui/borrowck/move-in-pattern-mut.rs +++ b/src/test/ui/borrowck/move-in-pattern-mut.rs @@ -15,9 +15,9 @@ fn main() { if let Some(mut x) = s { x = S; } - foo(s); //~ ERROR use of moved value: `s` + foo(s); //~ ERROR use of partially moved value: `s` let mut e = E::V { s: S }; let E::V { s: mut x } = e; x = S; - bar(e); //~ ERROR use of moved value: `e` + bar(e); //~ ERROR use of partially moved value: `e` } diff --git a/src/test/ui/borrowck/move-in-pattern-mut.stderr b/src/test/ui/borrowck/move-in-pattern-mut.stderr index 391638444c3b..17bc5492756e 100644 --- a/src/test/ui/borrowck/move-in-pattern-mut.stderr +++ b/src/test/ui/borrowck/move-in-pattern-mut.stderr @@ -1,28 +1,28 @@ -error[E0382]: use of moved value: `s` +error[E0382]: use of partially moved value: `s` --> $DIR/move-in-pattern-mut.rs:18:9 | LL | if let Some(mut x) = s { - | ----- value moved here + | ----- value partially moved here ... LL | foo(s); | ^ value used here after partial move | - = note: move occurs because value has type `S`, which does not implement the `Copy` trait + = note: partial move occurs because value has type `S`, which does not implement the `Copy` trait help: borrow this field in the pattern to avoid moving `s.0` | LL | if let Some(ref mut x) = s { | ^^^ -error[E0382]: use of moved value: `e` +error[E0382]: use of partially moved value: `e` --> $DIR/move-in-pattern-mut.rs:22:9 | LL | let E::V { s: mut x } = e; - | ----- value moved here + | ----- value partially moved here LL | x = S; LL | bar(e); | ^ value used here after partial move | - = note: move occurs because value has type `S`, which does not implement the `Copy` trait + = note: partial move occurs because value has type `S`, which does not implement the `Copy` trait help: borrow this field in the pattern to avoid moving `e.s` | LL | let E::V { s: ref mut x } = e; diff --git a/src/test/ui/borrowck/move-in-pattern.fixed b/src/test/ui/borrowck/move-in-pattern.fixed index f55fdcc5f90e..145893d3343b 100644 --- a/src/test/ui/borrowck/move-in-pattern.fixed +++ b/src/test/ui/borrowck/move-in-pattern.fixed @@ -16,9 +16,9 @@ fn main() { if let Some(ref x) = s { let _ = x; } - foo(s); //~ ERROR use of moved value: `s` + foo(s); //~ ERROR use of partially moved value: `s` let e = E::V { s: S }; let E::V { s: ref x } = e; let _ = x; - bar(e); //~ ERROR use of moved value: `e` + bar(e); //~ ERROR use of partially moved value: `e` } diff --git a/src/test/ui/borrowck/move-in-pattern.rs b/src/test/ui/borrowck/move-in-pattern.rs index 7ad04b9490c2..14851d0f6fcf 100644 --- a/src/test/ui/borrowck/move-in-pattern.rs +++ b/src/test/ui/borrowck/move-in-pattern.rs @@ -16,9 +16,9 @@ fn main() { if let Some(x) = s { let _ = x; } - foo(s); //~ ERROR use of moved value: `s` + foo(s); //~ ERROR use of partially moved value: `s` let e = E::V { s: S }; let E::V { s: x } = e; let _ = x; - bar(e); //~ ERROR use of moved value: `e` + bar(e); //~ ERROR use of partially moved value: `e` } diff --git a/src/test/ui/borrowck/move-in-pattern.stderr b/src/test/ui/borrowck/move-in-pattern.stderr index c5cb24455eb6..21ba92f1fc41 100644 --- a/src/test/ui/borrowck/move-in-pattern.stderr +++ b/src/test/ui/borrowck/move-in-pattern.stderr @@ -1,28 +1,28 @@ -error[E0382]: use of moved value: `s` +error[E0382]: use of partially moved value: `s` --> $DIR/move-in-pattern.rs:19:9 | LL | if let Some(x) = s { - | - value moved here + | - value partially moved here ... LL | foo(s); | ^ value used here after partial move | - = note: move occurs because value has type `S`, which does not implement the `Copy` trait + = note: partial move occurs because value has type `S`, which does not implement the `Copy` trait help: borrow this field in the pattern to avoid moving `s.0` | LL | if let Some(ref x) = s { | ^^^ -error[E0382]: use of moved value: `e` +error[E0382]: use of partially moved value: `e` --> $DIR/move-in-pattern.rs:23:9 | LL | let E::V { s: x } = e; - | - value moved here + | - value partially moved here LL | let _ = x; LL | bar(e); | ^ value used here after partial move | - = note: move occurs because value has type `S`, which does not implement the `Copy` trait + = note: partial move occurs because value has type `S`, which does not implement the `Copy` trait help: borrow this field in the pattern to avoid moving `e.s` | LL | let E::V { s: ref x } = e; diff --git a/src/test/ui/moves/moves-based-on-type-cyclic-types-issue-4821.rs b/src/test/ui/moves/moves-based-on-type-cyclic-types-issue-4821.rs index b070671cb250..4417fb926d96 100644 --- a/src/test/ui/moves/moves-based-on-type-cyclic-types-issue-4821.rs +++ b/src/test/ui/moves/moves-based-on-type-cyclic-types-issue-4821.rs @@ -10,7 +10,7 @@ fn foo(node: Box) -> isize { Some(right) => consume(right), None => 0 }; - consume(node) + r //~ ERROR use of moved value: `node` + consume(node) + r //~ ERROR use of partially moved value: `node` } fn consume(v: Box) -> isize { diff --git a/src/test/ui/moves/moves-based-on-type-cyclic-types-issue-4821.stderr b/src/test/ui/moves/moves-based-on-type-cyclic-types-issue-4821.stderr index 952985fcddee..49964e2a947c 100644 --- a/src/test/ui/moves/moves-based-on-type-cyclic-types-issue-4821.stderr +++ b/src/test/ui/moves/moves-based-on-type-cyclic-types-issue-4821.stderr @@ -1,13 +1,13 @@ -error[E0382]: use of moved value: `node` +error[E0382]: use of partially moved value: `node` --> $DIR/moves-based-on-type-cyclic-types-issue-4821.rs:13:13 | LL | Some(right) => consume(right), - | ----- value moved here + | ----- value partially moved here ... LL | consume(node) + r | ^^^^ value used here after partial move | - = note: move occurs because value has type `std::boxed::Box`, which does not implement the `Copy` trait + = note: partial move occurs because value has type `std::boxed::Box`, which does not implement the `Copy` trait help: borrow this field in the pattern to avoid moving `node.next.0` | LL | Some(ref right) => consume(right), diff --git a/src/test/ui/moves/moves-based-on-type-match-bindings.rs b/src/test/ui/moves/moves-based-on-type-match-bindings.rs index 1290d4a25abc..75fc6085f0aa 100644 --- a/src/test/ui/moves/moves-based-on-type-match-bindings.rs +++ b/src/test/ui/moves/moves-based-on-type-match-bindings.rs @@ -13,9 +13,9 @@ fn f10() { Foo {f} => {} }; - touch(&x); //~ ERROR borrow of moved value: `x` + touch(&x); //~ ERROR borrow of partially moved value: `x` //~^ value borrowed here after partial move - //~| move occurs because `x.f` has type `std::string::String` + //~| partial move occurs because `x.f` has type `std::string::String` } fn main() {} diff --git a/src/test/ui/moves/moves-based-on-type-match-bindings.stderr b/src/test/ui/moves/moves-based-on-type-match-bindings.stderr index 322999a1f0ff..2ee8d8d0b755 100644 --- a/src/test/ui/moves/moves-based-on-type-match-bindings.stderr +++ b/src/test/ui/moves/moves-based-on-type-match-bindings.stderr @@ -1,13 +1,13 @@ -error[E0382]: borrow of moved value: `x` +error[E0382]: borrow of partially moved value: `x` --> $DIR/moves-based-on-type-match-bindings.rs:16:11 | LL | Foo {f} => {} - | - value moved here + | - value partially moved here ... LL | touch(&x); | ^^ value borrowed here after partial move | - = note: move occurs because `x.f` has type `std::string::String`, which does not implement the `Copy` trait + = note: partial move occurs because `x.f` has type `std::string::String`, which does not implement the `Copy` trait error: aborting due to previous error diff --git a/src/test/ui/nll/move-subpaths-moves-root.rs b/src/test/ui/nll/move-subpaths-moves-root.rs index e7caf89e7839..d266c6bb6584 100644 --- a/src/test/ui/nll/move-subpaths-moves-root.rs +++ b/src/test/ui/nll/move-subpaths-moves-root.rs @@ -1,5 +1,5 @@ fn main() { let x = (vec![1, 2, 3], ); drop(x.0); - drop(x); //~ ERROR use of moved value + drop(x); //~ ERROR use of partially moved value } diff --git a/src/test/ui/nll/move-subpaths-moves-root.stderr b/src/test/ui/nll/move-subpaths-moves-root.stderr index 7030d5b3305f..d86801cf296b 100644 --- a/src/test/ui/nll/move-subpaths-moves-root.stderr +++ b/src/test/ui/nll/move-subpaths-moves-root.stderr @@ -1,12 +1,12 @@ -error[E0382]: use of moved value: `x` +error[E0382]: use of partially moved value: `x` --> $DIR/move-subpaths-moves-root.rs:4:10 | LL | drop(x.0); - | --- value moved here + | --- value partially moved here LL | drop(x); | ^ value used here after partial move | - = note: move occurs because `x.0` has type `std::vec::Vec`, which does not implement the `Copy` trait + = note: partial move occurs because `x.0` has type `std::vec::Vec`, which does not implement the `Copy` trait error: aborting due to previous error diff --git a/src/test/ui/ref-suggestion.rs b/src/test/ui/ref-suggestion.rs index 49d199cd9e75..346d118f0f9a 100644 --- a/src/test/ui/ref-suggestion.rs +++ b/src/test/ui/ref-suggestion.rs @@ -13,5 +13,5 @@ fn main() { (Some(y), ()) => {}, _ => {}, } - x; //~ ERROR use of moved value + x; //~ ERROR use of partially moved value } diff --git a/src/test/ui/ref-suggestion.stderr b/src/test/ui/ref-suggestion.stderr index 97d2c174d9ad..313ad087c348 100644 --- a/src/test/ui/ref-suggestion.stderr +++ b/src/test/ui/ref-suggestion.stderr @@ -18,16 +18,16 @@ LL | let mut y = x; LL | x; | ^ value used here after move -error[E0382]: use of moved value: `x` +error[E0382]: use of partially moved value: `x` --> $DIR/ref-suggestion.rs:16:5 | LL | (Some(y), ()) => {}, - | - value moved here + | - value partially moved here ... LL | x; | ^ value used here after partial move | - = note: move occurs because value has type `std::vec::Vec`, which does not implement the `Copy` trait + = note: partial move occurs because value has type `std::vec::Vec`, which does not implement the `Copy` trait help: borrow this field in the pattern to avoid moving `x.0.0` | LL | (Some(ref y), ()) => {}, diff --git a/src/test/ui/unsized-locals/borrow-after-move.stderr b/src/test/ui/unsized-locals/borrow-after-move.stderr index 906b543e4212..13f9507d8db9 100644 --- a/src/test/ui/unsized-locals/borrow-after-move.stderr +++ b/src/test/ui/unsized-locals/borrow-after-move.stderr @@ -5,7 +5,7 @@ LL | let y = *x; | -- value moved here LL | drop_unsized(y); LL | println!("{}", &x); - | ^^ value borrowed here after partial move + | ^^ value borrowed here after move | = note: move occurs because `*x` has type `str`, which does not implement the `Copy` trait @@ -27,7 +27,7 @@ LL | let y = *x; | -- value moved here LL | y.foo(); LL | println!("{}", &x); - | ^^ value borrowed here after partial move + | ^^ value borrowed here after move | = note: move occurs because `*x` has type `str`, which does not implement the `Copy` trait diff --git a/src/test/ui/unsized-locals/double-move.stderr b/src/test/ui/unsized-locals/double-move.stderr index 49b2031c6b9d..5b29314ad55a 100644 --- a/src/test/ui/unsized-locals/double-move.stderr +++ b/src/test/ui/unsized-locals/double-move.stderr @@ -14,7 +14,7 @@ error[E0382]: use of moved value: `x` LL | let _y = *x; | -- value moved here LL | drop_unsized(x); - | ^ value used here after partial move + | ^ value used here after move | = note: move occurs because `*x` has type `str`, which does not implement the `Copy` trait @@ -50,7 +50,7 @@ error[E0382]: use of moved value: `x` LL | let _y = *x; | -- value moved here LL | x.foo(); - | ^ value used here after partial move + | ^ value used here after move | = note: move occurs because `*x` has type `str`, which does not implement the `Copy` trait