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.
This commit is contained in:
Aaron Hill 2020-08-08 13:16:43 -04:00
parent c989ac132a
commit 5f7436b5fd
No known key found for this signature in database
GPG Key ID: B4087E510E98B164
31 changed files with 300 additions and 257 deletions

View File

@ -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, &note_msg, ty, span);
self.note_type_does_not_implement_copy(&mut err, &note_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

View File

@ -412,10 +412,11 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
place_desc: &str,
ty: Ty<'tcx>,
span: Option<Span>,
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);

View File

@ -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),
"",
);
}
}

View File

@ -8,7 +8,7 @@ impl<S> Ia<S> {
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`
}
}

View File

@ -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

View File

@ -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

View File

@ -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 @ ..] => {}
}
}

View File

@ -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

View File

@ -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 @ ..] => {}
}
}

View File

@ -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

View File

@ -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

View File

@ -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 @ ..] => {}
}
}

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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`
}

View File

@ -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;

View File

@ -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`
}

View File

@ -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`
}

View File

@ -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;

View File

@ -10,7 +10,7 @@ fn foo(node: Box<List>) -> 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<List>) -> isize {

View File

@ -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<List>`, which does not implement the `Copy` trait
= note: partial move occurs because value has type `std::boxed::Box<List>`, 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),

View File

@ -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() {}

View File

@ -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

View File

@ -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
}

View File

@ -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<i32>`, which does not implement the `Copy` trait
= note: partial move occurs because `x.0` has type `std::vec::Vec<i32>`, which does not implement the `Copy` trait
error: aborting due to previous error

View File

@ -13,5 +13,5 @@ fn main() {
(Some(y), ()) => {},
_ => {},
}
x; //~ ERROR use of moved value
x; //~ ERROR use of partially moved value
}

View File

@ -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<i32>`, which does not implement the `Copy` trait
= note: partial move occurs because value has type `std::vec::Vec<i32>`, which does not implement the `Copy` trait
help: borrow this field in the pattern to avoid moving `x.0.0`
|
LL | (Some(ref y), ()) => {},

View File

@ -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

View File

@ -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