From a15916b245b9a9d92ee77e3a995ff6bfd6c502fc Mon Sep 17 00:00:00 2001 From: Clint Frederickson Date: Tue, 5 Feb 2019 13:56:29 -0700 Subject: [PATCH 1/7] [WIP] add better error message for partial move --- src/librustc_mir/borrow_check/error_reporting.rs | 7 +++++-- .../ui/borrowck/borrowck-uninit-field-access.mir.stderr | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/librustc_mir/borrow_check/error_reporting.rs b/src/librustc_mir/borrow_check/error_reporting.rs index b070031756798..53b486cc6e316 100644 --- a/src/librustc_mir/borrow_check/error_reporting.rs +++ b/src/librustc_mir/borrow_check/error_reporting.rs @@ -130,6 +130,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { ); let mut is_loop_move = false; + let mut is_partial_move = false; 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; @@ -137,6 +138,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { let move_spans = self.move_spans(moved_place, move_out.source); let move_span = move_spans.args_or_use(); + is_partial_move = used_place.is_prefix_of(moved_place); let move_msg = if move_spans.for_closure() { " into closure" } else { @@ -175,8 +177,9 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { err.span_label( span, format!( - "value {} here after move", - desired_action.as_verb_in_past_tense() + "value {} here {}", + desired_action.as_verb_in_past_tense(), + if is_partial_move { "after partial move" } else { "after move" }, ), ); } diff --git a/src/test/ui/borrowck/borrowck-uninit-field-access.mir.stderr b/src/test/ui/borrowck/borrowck-uninit-field-access.mir.stderr index bdec94b4f84b0..99cbf64fd5d46 100644 --- a/src/test/ui/borrowck/borrowck-uninit-field-access.mir.stderr +++ b/src/test/ui/borrowck/borrowck-uninit-field-access.mir.stderr @@ -20,7 +20,7 @@ error[E0382]: use of moved value: `line2` LL | let _moved = (line2.origin, line2.middle); | ------------ value moved here LL | line2.consume(); //[ast]~ ERROR use of partially moved value: `line2` [E0382] - | ^^^^^ value used here after move + | ^^^^^ value used here after partial move | = note: move occurs because `line2.middle` has type `Point`, which does not implement the `Copy` trait From d4c52bfb1708bf1c53ea2fc722aa4d9762982e90 Mon Sep 17 00:00:00 2001 From: Clint Frederickson Date: Wed, 6 Feb 2019 08:42:21 -0700 Subject: [PATCH 2/7] error output updated by ./x.py test --stage 1 src/test/ui --incremental --bless --- src/test/ui/borrowck/borrowck-asm.mir.stderr | 4 ++-- .../ui/borrowck/borrowck-describe-lvalue.mir.stderr | 2 +- src/test/ui/borrowck/borrowck-drop-from-guard.stderr | 2 +- src/test/ui/borrowck/borrowck-issue-48962.stderr | 4 ++-- .../borrowck-move-moved-value-into-closure.mir.stderr | 2 +- .../borrowck/borrowck-move-out-from-array.mir.stderr | 4 ++-- src/test/ui/borrowck/borrowck-reinit.stderr | 2 +- ...499-field-mutation-of-moved-out-with-mut.nll.stderr | 6 +++--- .../issue-54499-field-mutation-of-moved-out.nll.stderr | 6 +++--- .../ui/borrowck/two-phase-nonrecv-autoref.nll.stderr | 4 ++-- src/test/ui/issues/issue-29723.stderr | 2 +- src/test/ui/issues/issue-34721.stderr | 2 +- src/test/ui/moves/moves-based-on-type-tuple.stderr | 2 +- src/test/ui/nll/closure-access-spans.stderr | 8 ++++---- src/test/ui/nll/closure-move-spans.stderr | 6 +++--- src/test/ui/nll/decl-macro-illegal-copy.stderr | 2 +- .../issue-21232-partial-init-and-erroneous-use.stderr | 2 +- .../ui/nll/issue-21232-partial-init-and-use.stderr | 10 +++++----- src/test/ui/nll/move-subpaths-moves-root.stderr | 2 +- src/test/ui/try-block/try-block-bad-lifetime.stderr | 2 +- .../ui/try-block/try-block-maybe-bad-lifetime.stderr | 2 +- 21 files changed, 38 insertions(+), 38 deletions(-) diff --git a/src/test/ui/borrowck/borrowck-asm.mir.stderr b/src/test/ui/borrowck/borrowck-asm.mir.stderr index 86e4832b3873c..71b4dbe2aa0c9 100644 --- a/src/test/ui/borrowck/borrowck-asm.mir.stderr +++ b/src/test/ui/borrowck/borrowck-asm.mir.stderr @@ -8,7 +8,7 @@ LL | asm!("nop" : : "r"(x)); | - value moved here LL | } LL | let z = x; //[ast]~ ERROR use of moved value: `x` - | ^ value used here after move + | ^ value used here after partial move error[E0503]: cannot use `x` because it was mutably borrowed --> $DIR/borrowck-asm.rs:35:32 @@ -71,7 +71,7 @@ LL | let x = &mut 2; | - move occurs because `x` has type `&mut i32`, which does not implement the `Copy` trait LL | unsafe { LL | asm!("nop" : : "r"(x), "r"(x) ); //[ast]~ ERROR use of moved value - | - ^ value used here after move + | - ^ value used here after partial move | | | value moved here diff --git a/src/test/ui/borrowck/borrowck-describe-lvalue.mir.stderr b/src/test/ui/borrowck/borrowck-describe-lvalue.mir.stderr index 279548f870fd0..52cb98333ac2e 100644 --- a/src/test/ui/borrowck/borrowck-describe-lvalue.mir.stderr +++ b/src/test/ui/borrowck/borrowck-describe-lvalue.mir.stderr @@ -367,7 +367,7 @@ error[E0382]: use of moved value: `x` LL | drop(x); | - value moved here LL | drop(x); //[ast]~ ERROR use of moved value: `x` - | ^ value used here after move + | ^ value used here after partial move | = note: move occurs because `x` has type `std::vec::Vec`, which does not implement the `Copy` trait diff --git a/src/test/ui/borrowck/borrowck-drop-from-guard.stderr b/src/test/ui/borrowck/borrowck-drop-from-guard.stderr index 07b597f480feb..c2db8b5830f55 100644 --- a/src/test/ui/borrowck/borrowck-drop-from-guard.stderr +++ b/src/test/ui/borrowck/borrowck-drop-from-guard.stderr @@ -8,7 +8,7 @@ LL | Some(_) if { drop(my_str); false } => {} | ------ value moved here LL | Some(_) => {} LL | None => { foo(my_str); } //~ ERROR [E0382] - | ^^^^^^ value used here after move + | ^^^^^^ value used here after partial move error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-issue-48962.stderr b/src/test/ui/borrowck/borrowck-issue-48962.stderr index de4894d5b526b..d0105e311bc69 100644 --- a/src/test/ui/borrowck/borrowck-issue-48962.stderr +++ b/src/test/ui/borrowck/borrowck-issue-48962.stderr @@ -6,7 +6,7 @@ LL | let mut src = &mut node; LL | {src}; | --- value moved here LL | src.next = None; //~ ERROR use of moved value: `src` [E0382] - | ^^^^^^^^ value used here after move + | ^^^^^^^^ value used here after partial move error[E0382]: use of moved value: `src` --> $DIR/borrowck-issue-48962.rs:22:5 @@ -16,7 +16,7 @@ LL | let mut src = &mut (22, 44); LL | {src}; | --- value moved here LL | src.0 = 66; //~ ERROR use of moved value: `src` [E0382] - | ^^^^^^^^^^ value used here after move + | ^^^^^^^^^^ value used here after partial move error: aborting due to 2 previous errors diff --git a/src/test/ui/borrowck/borrowck-move-moved-value-into-closure.mir.stderr b/src/test/ui/borrowck/borrowck-move-moved-value-into-closure.mir.stderr index 0789926563ce7..e362fcb7d54cd 100644 --- a/src/test/ui/borrowck/borrowck-move-moved-value-into-closure.mir.stderr +++ b/src/test/ui/borrowck/borrowck-move-moved-value-into-closure.mir.stderr @@ -11,7 +11,7 @@ LL | call_f(move|| { *t + 1 }); LL | call_f(move|| { *t + 1 }); //[ast]~ ERROR capture of moved value | ^^^^^^ - use occurs due to use in closure | | - | value used here after move + | value used here after partial move error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-move-out-from-array.mir.stderr b/src/test/ui/borrowck/borrowck-move-out-from-array.mir.stderr index f866ff9e9bae1..e366d7b95c368 100644 --- a/src/test/ui/borrowck/borrowck-move-out-from-array.mir.stderr +++ b/src/test/ui/borrowck/borrowck-move-out-from-array.mir.stderr @@ -4,7 +4,7 @@ error[E0382]: use of moved value: `a[..]` LL | let [_, _x] = a; | -- value moved here LL | let [.., _y] = a; //[ast]~ ERROR [E0382] - | ^^ value used here after move + | ^^ value used here after partial move | = note: move occurs because `a[..]` has type `std::boxed::Box`, which does not implement the `Copy` trait @@ -14,7 +14,7 @@ error[E0382]: use of moved value: `a[..]` LL | let [_x, _] = a; | -- value moved here LL | let [_y..] = a; //[ast]~ ERROR [E0382] - | ^^ value used here after move + | ^^ value used here after partial move | = note: move occurs because `a[..]` has type `std::boxed::Box`, which does not implement the `Copy` trait diff --git a/src/test/ui/borrowck/borrowck-reinit.stderr b/src/test/ui/borrowck/borrowck-reinit.stderr index 96f3981ac2fe6..351fbab2d3f09 100644 --- a/src/test/ui/borrowck/borrowck-reinit.stderr +++ b/src/test/ui/borrowck/borrowck-reinit.stderr @@ -17,7 +17,7 @@ LL | let mut x = Box::new(0); LL | drop(x); | - value moved here LL | let _ = (1,x); //~ ERROR use of moved value: `x` (Ast) - | ^ value used here after move + | ^ value used here after partial move error: aborting due to 2 previous errors diff --git a/src/test/ui/borrowck/issue-54499-field-mutation-of-moved-out-with-mut.nll.stderr b/src/test/ui/borrowck/issue-54499-field-mutation-of-moved-out-with-mut.nll.stderr index 42aa038170238..bdf99b0906e6f 100644 --- a/src/test/ui/borrowck/issue-54499-field-mutation-of-moved-out-with-mut.nll.stderr +++ b/src/test/ui/borrowck/issue-54499-field-mutation-of-moved-out-with-mut.nll.stderr @@ -6,7 +6,7 @@ LL | let mut t: Tuple = (S(0), 0); LL | drop(t); | - value moved here LL | t.0 = S(1); - | ^^^^^^^^^^ value partially assigned here after move + | ^^^^^^^^^^ value partially assigned here after partial move error[E0382]: assign to part of moved value: `u` --> $DIR/issue-54499-field-mutation-of-moved-out-with-mut.rs:34:9 @@ -16,7 +16,7 @@ LL | let mut u: Tpair = Tpair(S(0), 0); LL | drop(u); | - value moved here LL | u.0 = S(1); - | ^^^^^^^^^^ value partially assigned here after move + | ^^^^^^^^^^ value partially assigned here after partial move error[E0382]: assign to part of moved value: `v` --> $DIR/issue-54499-field-mutation-of-moved-out-with-mut.rs:45:9 @@ -26,7 +26,7 @@ LL | let mut v: Spair = Spair { x: S(0), y: 0 }; LL | drop(v); | - value moved here LL | v.x = S(1); - | ^^^^^^^^^^ value partially assigned here after move + | ^^^^^^^^^^ value partially assigned here after partial move error: aborting due to 3 previous errors diff --git a/src/test/ui/borrowck/issue-54499-field-mutation-of-moved-out.nll.stderr b/src/test/ui/borrowck/issue-54499-field-mutation-of-moved-out.nll.stderr index 1184907f307cb..9505f305c6151 100644 --- a/src/test/ui/borrowck/issue-54499-field-mutation-of-moved-out.nll.stderr +++ b/src/test/ui/borrowck/issue-54499-field-mutation-of-moved-out.nll.stderr @@ -15,7 +15,7 @@ LL | let t: Tuple = (S(0), 0); LL | drop(t); | - value moved here LL | t.0 = S(1); - | ^^^^^^^^^^ value partially assigned here after move + | ^^^^^^^^^^ value partially assigned here after partial move error[E0594]: cannot assign to `t.1`, as `t` is not declared as mutable --> $DIR/issue-54499-field-mutation-of-moved-out.rs:27:9 @@ -43,7 +43,7 @@ LL | let u: Tpair = Tpair(S(0), 0); LL | drop(u); | - value moved here LL | u.0 = S(1); - | ^^^^^^^^^^ value partially assigned here after move + | ^^^^^^^^^^ value partially assigned here after partial move error[E0594]: cannot assign to `u.1`, as `u` is not declared as mutable --> $DIR/issue-54499-field-mutation-of-moved-out.rs:42:9 @@ -71,7 +71,7 @@ LL | let v: Spair = Spair { x: S(0), y: 0 }; LL | drop(v); | - value moved here LL | v.x = S(1); - | ^^^^^^^^^^ value partially assigned here after move + | ^^^^^^^^^^ value partially assigned here after partial move error[E0594]: cannot assign to `v.y`, as `v` is not declared as mutable --> $DIR/issue-54499-field-mutation-of-moved-out.rs:57:9 diff --git a/src/test/ui/borrowck/two-phase-nonrecv-autoref.nll.stderr b/src/test/ui/borrowck/two-phase-nonrecv-autoref.nll.stderr index d026f81b7aad6..39ff1234eb7f9 100644 --- a/src/test/ui/borrowck/two-phase-nonrecv-autoref.nll.stderr +++ b/src/test/ui/borrowck/two-phase-nonrecv-autoref.nll.stderr @@ -13,7 +13,7 @@ error[E0382]: use of moved value: `*f` LL | fn twice_ten_so i32>(f: Box) { | - consider adding a `Copy` constraint to this type argument LL | f(f(10)); - | - ^ value used here after move + | - ^ value used here after partial move | | | value moved here | @@ -44,7 +44,7 @@ error[E0382]: use of moved value: `*f` --> $DIR/two-phase-nonrecv-autoref.rs:85:11 | LL | f(f(10)); - | - ^ value used here after move + | - ^ value used here after partial move | | | value moved here | diff --git a/src/test/ui/issues/issue-29723.stderr b/src/test/ui/issues/issue-29723.stderr index 7928af5d5a5cd..71bf9cfd0997c 100644 --- a/src/test/ui/issues/issue-29723.stderr +++ b/src/test/ui/issues/issue-29723.stderr @@ -8,7 +8,7 @@ LL | 0 if { drop(s); false } => String::from("oops"), | - value moved here ... LL | s - | ^ value used here after move + | ^ value used here after partial move error: aborting due to previous error diff --git a/src/test/ui/issues/issue-34721.stderr b/src/test/ui/issues/issue-34721.stderr index 2ed7b543e713c..936467fce8277 100644 --- a/src/test/ui/issues/issue-34721.stderr +++ b/src/test/ui/issues/issue-34721.stderr @@ -13,7 +13,7 @@ LL | x.zero() | - value moved here LL | }; LL | x.zero() - | ^ value used here after move + | ^ value used here after partial move error: aborting due to previous error diff --git a/src/test/ui/moves/moves-based-on-type-tuple.stderr b/src/test/ui/moves/moves-based-on-type-tuple.stderr index c49dbdab40210..bbf88959ebd9d 100644 --- a/src/test/ui/moves/moves-based-on-type-tuple.stderr +++ b/src/test/ui/moves/moves-based-on-type-tuple.stderr @@ -14,7 +14,7 @@ error[E0382]: use of moved value: `x` (Mir) LL | fn dup(x: Box) -> Box<(Box,Box)> { | - move occurs because `x` has type `std::boxed::Box`, which does not implement the `Copy` trait LL | box (x, x) - | - ^ value used here after move + | - ^ value used here after partial move | | | value moved here diff --git a/src/test/ui/nll/closure-access-spans.stderr b/src/test/ui/nll/closure-access-spans.stderr index 3ca0aefb592e0..67b0fb422e26f 100644 --- a/src/test/ui/nll/closure-access-spans.stderr +++ b/src/test/ui/nll/closure-access-spans.stderr @@ -66,7 +66,7 @@ LL | let r = x; LL | || x.len(); //~ ERROR | ^^ - borrow occurs due to use in closure | | - | value borrowed here after move + | value borrowed here after partial move error[E0382]: borrow of moved value: `x` --> $DIR/closure-access-spans.rs:42:5 @@ -78,7 +78,7 @@ LL | let r = x; LL | || x = String::new(); //~ ERROR | ^^ - borrow occurs due to use in closure | | - | value borrowed here after move + | value borrowed here after partial move error[E0382]: borrow of moved value: `x` --> $DIR/closure-access-spans.rs:47:5 @@ -90,7 +90,7 @@ LL | let r = x; LL | || *x = String::new(); //~ ERROR | ^^ - borrow occurs due to use in closure | | - | value borrowed here after move + | value borrowed here after partial move error[E0382]: use of moved value: `x` --> $DIR/closure-access-spans.rs:52:5 @@ -102,7 +102,7 @@ LL | let r = x; LL | || x; //~ ERROR | ^^ - use occurs due to use in closure | | - | value used here after move + | value used here after partial move error: aborting due to 9 previous errors diff --git a/src/test/ui/nll/closure-move-spans.stderr b/src/test/ui/nll/closure-move-spans.stderr index 6750c4047601a..53f3a8c82e0b5 100644 --- a/src/test/ui/nll/closure-move-spans.stderr +++ b/src/test/ui/nll/closure-move-spans.stderr @@ -8,7 +8,7 @@ LL | || x; | | | value moved into closure here LL | let y = x; //~ ERROR - | ^ value used here after move + | ^ value used here after partial move error[E0382]: borrow of moved value: `x` --> $DIR/closure-move-spans.rs:12:13 @@ -20,7 +20,7 @@ LL | || x; | | | value moved into closure here LL | let y = &x; //~ ERROR - | ^^ value borrowed here after move + | ^^ value borrowed here after partial move error[E0382]: borrow of moved value: `x` --> $DIR/closure-move-spans.rs:17:13 @@ -32,7 +32,7 @@ LL | || x; | | | value moved into closure here LL | let y = &mut x; //~ ERROR - | ^^^^^^ value borrowed here after move + | ^^^^^^ value borrowed here after partial move error: aborting due to 3 previous errors diff --git a/src/test/ui/nll/decl-macro-illegal-copy.stderr b/src/test/ui/nll/decl-macro-illegal-copy.stderr index 9232ff52393e1..9e1ba3a4e1bcb 100644 --- a/src/test/ui/nll/decl-macro-illegal-copy.stderr +++ b/src/test/ui/nll/decl-macro-illegal-copy.stderr @@ -5,7 +5,7 @@ LL | $wrapper.inner | -------------- value moved here ... LL | wrapper.inner, - | ^^^^^^^^^^^^^ value used here after move + | ^^^^^^^^^^^^^ value used here after partial move | = note: move occurs because `wrapper.inner` has type `NonCopy`, which does not implement the `Copy` trait diff --git a/src/test/ui/nll/issue-21232-partial-init-and-erroneous-use.stderr b/src/test/ui/nll/issue-21232-partial-init-and-erroneous-use.stderr index 54c728e3d2783..7715c14d7a345 100644 --- a/src/test/ui/nll/issue-21232-partial-init-and-erroneous-use.stderr +++ b/src/test/ui/nll/issue-21232-partial-init-and-erroneous-use.stderr @@ -18,7 +18,7 @@ LL | let mut d = D { x: 0, s: S{ y: 0, z: 0 } }; LL | drop(d); | - value moved here LL | d.x = 10; - | ^^^^^^^^ value assigned here after move + | ^^^^^^^^ value assigned here after partial move error[E0381]: assign to part of possibly uninitialized variable: `d` --> $DIR/issue-21232-partial-init-and-erroneous-use.rs:49:5 diff --git a/src/test/ui/nll/issue-21232-partial-init-and-use.stderr b/src/test/ui/nll/issue-21232-partial-init-and-use.stderr index 23da533252cb9..ac15d9ba26c4d 100644 --- a/src/test/ui/nll/issue-21232-partial-init-and-use.stderr +++ b/src/test/ui/nll/issue-21232-partial-init-and-use.stderr @@ -18,7 +18,7 @@ LL | let mut s: S = S::new(); drop(s); | | | move occurs because `s` has type `S>`, which does not implement the `Copy` trait LL | s.x = 10; s.y = Box::new(20); - | ^^^^^^^^ value partially assigned here after move + | ^^^^^^^^ value partially assigned here after partial move error[E0382]: assign to part of moved value: `t` --> $DIR/issue-21232-partial-init-and-use.rs:120:5 @@ -28,7 +28,7 @@ LL | let mut t: T = (0, Box::new(0)); drop(t); | | | move occurs because `t` has type `(u32, std::boxed::Box)`, which does not implement the `Copy` trait LL | t.0 = 10; t.1 = Box::new(20); - | ^^^^^^^^ value partially assigned here after move + | ^^^^^^^^ value partially assigned here after partial move error[E0381]: assign to part of possibly uninitialized variable: `s` --> $DIR/issue-21232-partial-init-and-use.rs:127:5 @@ -50,7 +50,7 @@ LL | let mut s: S = S::new(); drop(s); | | | move occurs because `s` has type `S>`, which does not implement the `Copy` trait LL | s.x = 10; - | ^^^^^^^^ value partially assigned here after move + | ^^^^^^^^ value partially assigned here after partial move error[E0382]: assign to part of moved value: `t` --> $DIR/issue-21232-partial-init-and-use.rs:148:5 @@ -60,7 +60,7 @@ LL | let mut t: T = (0, Box::new(0)); drop(t); | | | move occurs because `t` has type `(u32, std::boxed::Box)`, which does not implement the `Copy` trait LL | t.0 = 10; - | ^^^^^^^^ value partially assigned here after move + | ^^^^^^^^ value partially assigned here after partial move error[E0381]: assign to part of possibly uninitialized variable: `s` --> $DIR/issue-21232-partial-init-and-use.rs:155:5 @@ -159,7 +159,7 @@ LL | match c { LL | c2 => { | -- value moved here LL | c.0 = 2; //~ ERROR assign to part of moved value - | ^^^^^^^ value partially assigned here after move + | ^^^^^^^ value partially assigned here after partial move error[E0382]: assign to part of moved value: `c` --> $DIR/issue-21232-partial-init-and-use.rs:269:13 diff --git a/src/test/ui/nll/move-subpaths-moves-root.stderr b/src/test/ui/nll/move-subpaths-moves-root.stderr index 0dd396f855dc5..8b52cc113ccc5 100644 --- a/src/test/ui/nll/move-subpaths-moves-root.stderr +++ b/src/test/ui/nll/move-subpaths-moves-root.stderr @@ -4,7 +4,7 @@ error[E0382]: use of moved value: `x` LL | drop(x.0); | --- value moved here LL | drop(x); //~ ERROR use of moved value - | ^ value used here after move + | ^ value used here after partial move | = note: move occurs because `x.0` has type `std::vec::Vec`, which does not implement the `Copy` trait diff --git a/src/test/ui/try-block/try-block-bad-lifetime.stderr b/src/test/ui/try-block/try-block-bad-lifetime.stderr index b1b925d694ff9..8967e77b5a7cc 100644 --- a/src/test/ui/try-block/try-block-bad-lifetime.stderr +++ b/src/test/ui/try-block/try-block-bad-lifetime.stderr @@ -32,7 +32,7 @@ LL | Err(k) ?; | - value moved here ... LL | ::std::mem::drop(k); //~ ERROR use of moved value: `k` - | ^ value used here after move + | ^ value used here after partial move error[E0506]: cannot assign to `i` because it is borrowed --> $DIR/try-block-bad-lifetime.rs:32:9 diff --git a/src/test/ui/try-block/try-block-maybe-bad-lifetime.stderr b/src/test/ui/try-block/try-block-maybe-bad-lifetime.stderr index dafbde6a5150b..33561eae46a2a 100644 --- a/src/test/ui/try-block/try-block-maybe-bad-lifetime.stderr +++ b/src/test/ui/try-block/try-block-maybe-bad-lifetime.stderr @@ -20,7 +20,7 @@ LL | ::std::mem::drop(x); | - value moved here LL | }; LL | println!("{}", x); //~ ERROR borrow of moved value: `x` - | ^ value borrowed here after move + | ^ value borrowed here after partial move error[E0506]: cannot assign to `i` because it is borrowed --> $DIR/try-block-maybe-bad-lifetime.rs:40:9 From 4e5eda36978e8868ee75001efb6388aa22326be0 Mon Sep 17 00:00:00 2001 From: Clint Frederickson Date: Tue, 12 Feb 2019 19:35:32 -0700 Subject: [PATCH 3/7] compute is_partial_move outside of the move_site loop for clarity --- src/librustc_mir/borrow_check/error_reporting.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/librustc_mir/borrow_check/error_reporting.rs b/src/librustc_mir/borrow_check/error_reporting.rs index 53b486cc6e316..e42c12125ee3d 100644 --- a/src/librustc_mir/borrow_check/error_reporting.rs +++ b/src/librustc_mir/borrow_check/error_reporting.rs @@ -130,7 +130,15 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { ); let mut is_loop_move = false; - let mut is_partial_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; +// dbg!(moved_place); +// dbg!(used_place); +// if used_place != moved_place { + used_place.is_prefix_of(moved_place) +// } else { false } + }); 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; @@ -138,7 +146,6 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { let move_spans = self.move_spans(moved_place, move_out.source); let move_span = move_spans.args_or_use(); - is_partial_move = used_place.is_prefix_of(moved_place); let move_msg = if move_spans.for_closure() { " into closure" } else { From 96fd2181ba97c75789579881fc62b68c8b65b759 Mon Sep 17 00:00:00 2001 From: Clint Frederickson Date: Wed, 13 Feb 2019 08:48:37 -0700 Subject: [PATCH 4/7] check if `used_place` and `moved_place` are equal when determining if the move was partial --- src/librustc_mir/borrow_check/error_reporting.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/librustc_mir/borrow_check/error_reporting.rs b/src/librustc_mir/borrow_check/error_reporting.rs index e42c12125ee3d..0fa427aea8137 100644 --- a/src/librustc_mir/borrow_check/error_reporting.rs +++ b/src/librustc_mir/borrow_check/error_reporting.rs @@ -133,11 +133,9 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { 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; -// dbg!(moved_place); -// dbg!(used_place); -// if used_place != moved_place { + if used_place != moved_place { used_place.is_prefix_of(moved_place) -// } else { false } + } else { false } }); for move_site in &move_site_vec { let move_out = self.move_data.moves[(*move_site).moi]; From 755b32027952d078396fb8f885ac306d7688234e Mon Sep 17 00:00:00 2001 From: Clint Frederickson Date: Wed, 13 Feb 2019 09:34:29 -0700 Subject: [PATCH 5/7] simplified conditional --- src/librustc_mir/borrow_check/error_reporting.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/librustc_mir/borrow_check/error_reporting.rs b/src/librustc_mir/borrow_check/error_reporting.rs index 0fa427aea8137..9678c7bb3dc15 100644 --- a/src/librustc_mir/borrow_check/error_reporting.rs +++ b/src/librustc_mir/borrow_check/error_reporting.rs @@ -133,9 +133,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { 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; - if used_place != moved_place { - used_place.is_prefix_of(moved_place) - } else { false } + used_place != moved_place && used_place.is_prefix_of(moved_place) }); for move_site in &move_site_vec { let move_out = self.move_data.moves[(*move_site).moi]; From de0554805cf2ec2c9fb01d86797214927f96d2e9 Mon Sep 17 00:00:00 2001 From: Clint Frederickson Date: Mon, 18 Feb 2019 12:33:33 -0700 Subject: [PATCH 6/7] re-blessing error output: ./x.py test src/test/ui --stage 1 --bless --- src/test/ui/borrowck/borrowck-asm.mir.stderr | 4 ++-- .../ui/borrowck/borrowck-describe-lvalue.mir.stderr | 2 +- src/test/ui/borrowck/borrowck-drop-from-guard.stderr | 2 +- src/test/ui/borrowck/borrowck-issue-48962.stderr | 4 ++-- .../borrowck-move-moved-value-into-closure.mir.stderr | 2 +- .../borrowck/borrowck-move-out-from-array.mir.stderr | 4 ++-- src/test/ui/borrowck/borrowck-reinit.stderr | 2 +- ...499-field-mutation-of-moved-out-with-mut.nll.stderr | 6 +++--- .../issue-54499-field-mutation-of-moved-out.nll.stderr | 6 +++--- .../ui/borrowck/two-phase-nonrecv-autoref.nll.stderr | 4 ++-- src/test/ui/issues/issue-29723.stderr | 2 +- src/test/ui/issues/issue-34721.stderr | 2 +- src/test/ui/moves/moves-based-on-type-tuple.stderr | 2 +- src/test/ui/nll/closure-access-spans.stderr | 8 ++++---- src/test/ui/nll/closure-move-spans.stderr | 6 +++--- src/test/ui/nll/decl-macro-illegal-copy.stderr | 2 +- .../issue-21232-partial-init-and-erroneous-use.stderr | 2 +- .../ui/nll/issue-21232-partial-init-and-use.stderr | 10 +++++----- src/test/ui/try-block/try-block-bad-lifetime.stderr | 2 +- .../ui/try-block/try-block-maybe-bad-lifetime.stderr | 2 +- 20 files changed, 37 insertions(+), 37 deletions(-) diff --git a/src/test/ui/borrowck/borrowck-asm.mir.stderr b/src/test/ui/borrowck/borrowck-asm.mir.stderr index 71b4dbe2aa0c9..86e4832b3873c 100644 --- a/src/test/ui/borrowck/borrowck-asm.mir.stderr +++ b/src/test/ui/borrowck/borrowck-asm.mir.stderr @@ -8,7 +8,7 @@ LL | asm!("nop" : : "r"(x)); | - value moved here LL | } LL | let z = x; //[ast]~ ERROR use of moved value: `x` - | ^ value used here after partial move + | ^ value used here after move error[E0503]: cannot use `x` because it was mutably borrowed --> $DIR/borrowck-asm.rs:35:32 @@ -71,7 +71,7 @@ LL | let x = &mut 2; | - move occurs because `x` has type `&mut i32`, which does not implement the `Copy` trait LL | unsafe { LL | asm!("nop" : : "r"(x), "r"(x) ); //[ast]~ ERROR use of moved value - | - ^ value used here after partial move + | - ^ value used here after move | | | value moved here diff --git a/src/test/ui/borrowck/borrowck-describe-lvalue.mir.stderr b/src/test/ui/borrowck/borrowck-describe-lvalue.mir.stderr index 52cb98333ac2e..279548f870fd0 100644 --- a/src/test/ui/borrowck/borrowck-describe-lvalue.mir.stderr +++ b/src/test/ui/borrowck/borrowck-describe-lvalue.mir.stderr @@ -367,7 +367,7 @@ error[E0382]: use of moved value: `x` LL | drop(x); | - value moved here LL | drop(x); //[ast]~ ERROR use of moved value: `x` - | ^ value used here after partial move + | ^ value used here after move | = note: move occurs because `x` has type `std::vec::Vec`, which does not implement the `Copy` trait diff --git a/src/test/ui/borrowck/borrowck-drop-from-guard.stderr b/src/test/ui/borrowck/borrowck-drop-from-guard.stderr index c2db8b5830f55..07b597f480feb 100644 --- a/src/test/ui/borrowck/borrowck-drop-from-guard.stderr +++ b/src/test/ui/borrowck/borrowck-drop-from-guard.stderr @@ -8,7 +8,7 @@ LL | Some(_) if { drop(my_str); false } => {} | ------ value moved here LL | Some(_) => {} LL | None => { foo(my_str); } //~ ERROR [E0382] - | ^^^^^^ value used here after partial move + | ^^^^^^ value used here after move error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-issue-48962.stderr b/src/test/ui/borrowck/borrowck-issue-48962.stderr index d0105e311bc69..de4894d5b526b 100644 --- a/src/test/ui/borrowck/borrowck-issue-48962.stderr +++ b/src/test/ui/borrowck/borrowck-issue-48962.stderr @@ -6,7 +6,7 @@ LL | let mut src = &mut node; LL | {src}; | --- value moved here LL | src.next = None; //~ ERROR use of moved value: `src` [E0382] - | ^^^^^^^^ value used here after partial move + | ^^^^^^^^ value used here after move error[E0382]: use of moved value: `src` --> $DIR/borrowck-issue-48962.rs:22:5 @@ -16,7 +16,7 @@ LL | let mut src = &mut (22, 44); LL | {src}; | --- value moved here LL | src.0 = 66; //~ ERROR use of moved value: `src` [E0382] - | ^^^^^^^^^^ value used here after partial move + | ^^^^^^^^^^ value used here after move error: aborting due to 2 previous errors diff --git a/src/test/ui/borrowck/borrowck-move-moved-value-into-closure.mir.stderr b/src/test/ui/borrowck/borrowck-move-moved-value-into-closure.mir.stderr index e362fcb7d54cd..0789926563ce7 100644 --- a/src/test/ui/borrowck/borrowck-move-moved-value-into-closure.mir.stderr +++ b/src/test/ui/borrowck/borrowck-move-moved-value-into-closure.mir.stderr @@ -11,7 +11,7 @@ LL | call_f(move|| { *t + 1 }); LL | call_f(move|| { *t + 1 }); //[ast]~ ERROR capture of moved value | ^^^^^^ - use occurs due to use in closure | | - | value used here after partial move + | value used here after move error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-move-out-from-array.mir.stderr b/src/test/ui/borrowck/borrowck-move-out-from-array.mir.stderr index e366d7b95c368..f866ff9e9bae1 100644 --- a/src/test/ui/borrowck/borrowck-move-out-from-array.mir.stderr +++ b/src/test/ui/borrowck/borrowck-move-out-from-array.mir.stderr @@ -4,7 +4,7 @@ error[E0382]: use of moved value: `a[..]` LL | let [_, _x] = a; | -- value moved here LL | let [.., _y] = a; //[ast]~ ERROR [E0382] - | ^^ value used here after partial move + | ^^ value used here after move | = note: move occurs because `a[..]` has type `std::boxed::Box`, which does not implement the `Copy` trait @@ -14,7 +14,7 @@ error[E0382]: use of moved value: `a[..]` LL | let [_x, _] = a; | -- value moved here LL | let [_y..] = a; //[ast]~ ERROR [E0382] - | ^^ value used here after partial move + | ^^ value used here after move | = note: move occurs because `a[..]` has type `std::boxed::Box`, which does not implement the `Copy` trait diff --git a/src/test/ui/borrowck/borrowck-reinit.stderr b/src/test/ui/borrowck/borrowck-reinit.stderr index 351fbab2d3f09..96f3981ac2fe6 100644 --- a/src/test/ui/borrowck/borrowck-reinit.stderr +++ b/src/test/ui/borrowck/borrowck-reinit.stderr @@ -17,7 +17,7 @@ LL | let mut x = Box::new(0); LL | drop(x); | - value moved here LL | let _ = (1,x); //~ ERROR use of moved value: `x` (Ast) - | ^ value used here after partial move + | ^ value used here after move error: aborting due to 2 previous errors diff --git a/src/test/ui/borrowck/issue-54499-field-mutation-of-moved-out-with-mut.nll.stderr b/src/test/ui/borrowck/issue-54499-field-mutation-of-moved-out-with-mut.nll.stderr index bdf99b0906e6f..42aa038170238 100644 --- a/src/test/ui/borrowck/issue-54499-field-mutation-of-moved-out-with-mut.nll.stderr +++ b/src/test/ui/borrowck/issue-54499-field-mutation-of-moved-out-with-mut.nll.stderr @@ -6,7 +6,7 @@ LL | let mut t: Tuple = (S(0), 0); LL | drop(t); | - value moved here LL | t.0 = S(1); - | ^^^^^^^^^^ value partially assigned here after partial move + | ^^^^^^^^^^ value partially assigned here after move error[E0382]: assign to part of moved value: `u` --> $DIR/issue-54499-field-mutation-of-moved-out-with-mut.rs:34:9 @@ -16,7 +16,7 @@ LL | let mut u: Tpair = Tpair(S(0), 0); LL | drop(u); | - value moved here LL | u.0 = S(1); - | ^^^^^^^^^^ value partially assigned here after partial move + | ^^^^^^^^^^ value partially assigned here after move error[E0382]: assign to part of moved value: `v` --> $DIR/issue-54499-field-mutation-of-moved-out-with-mut.rs:45:9 @@ -26,7 +26,7 @@ LL | let mut v: Spair = Spair { x: S(0), y: 0 }; LL | drop(v); | - value moved here LL | v.x = S(1); - | ^^^^^^^^^^ value partially assigned here after partial move + | ^^^^^^^^^^ value partially assigned here after move error: aborting due to 3 previous errors diff --git a/src/test/ui/borrowck/issue-54499-field-mutation-of-moved-out.nll.stderr b/src/test/ui/borrowck/issue-54499-field-mutation-of-moved-out.nll.stderr index 9505f305c6151..1184907f307cb 100644 --- a/src/test/ui/borrowck/issue-54499-field-mutation-of-moved-out.nll.stderr +++ b/src/test/ui/borrowck/issue-54499-field-mutation-of-moved-out.nll.stderr @@ -15,7 +15,7 @@ LL | let t: Tuple = (S(0), 0); LL | drop(t); | - value moved here LL | t.0 = S(1); - | ^^^^^^^^^^ value partially assigned here after partial move + | ^^^^^^^^^^ value partially assigned here after move error[E0594]: cannot assign to `t.1`, as `t` is not declared as mutable --> $DIR/issue-54499-field-mutation-of-moved-out.rs:27:9 @@ -43,7 +43,7 @@ LL | let u: Tpair = Tpair(S(0), 0); LL | drop(u); | - value moved here LL | u.0 = S(1); - | ^^^^^^^^^^ value partially assigned here after partial move + | ^^^^^^^^^^ value partially assigned here after move error[E0594]: cannot assign to `u.1`, as `u` is not declared as mutable --> $DIR/issue-54499-field-mutation-of-moved-out.rs:42:9 @@ -71,7 +71,7 @@ LL | let v: Spair = Spair { x: S(0), y: 0 }; LL | drop(v); | - value moved here LL | v.x = S(1); - | ^^^^^^^^^^ value partially assigned here after partial move + | ^^^^^^^^^^ value partially assigned here after move error[E0594]: cannot assign to `v.y`, as `v` is not declared as mutable --> $DIR/issue-54499-field-mutation-of-moved-out.rs:57:9 diff --git a/src/test/ui/borrowck/two-phase-nonrecv-autoref.nll.stderr b/src/test/ui/borrowck/two-phase-nonrecv-autoref.nll.stderr index 39ff1234eb7f9..d026f81b7aad6 100644 --- a/src/test/ui/borrowck/two-phase-nonrecv-autoref.nll.stderr +++ b/src/test/ui/borrowck/two-phase-nonrecv-autoref.nll.stderr @@ -13,7 +13,7 @@ error[E0382]: use of moved value: `*f` LL | fn twice_ten_so i32>(f: Box) { | - consider adding a `Copy` constraint to this type argument LL | f(f(10)); - | - ^ value used here after partial move + | - ^ value used here after move | | | value moved here | @@ -44,7 +44,7 @@ error[E0382]: use of moved value: `*f` --> $DIR/two-phase-nonrecv-autoref.rs:85:11 | LL | f(f(10)); - | - ^ value used here after partial move + | - ^ value used here after move | | | value moved here | diff --git a/src/test/ui/issues/issue-29723.stderr b/src/test/ui/issues/issue-29723.stderr index 71bf9cfd0997c..7928af5d5a5cd 100644 --- a/src/test/ui/issues/issue-29723.stderr +++ b/src/test/ui/issues/issue-29723.stderr @@ -8,7 +8,7 @@ LL | 0 if { drop(s); false } => String::from("oops"), | - value moved here ... LL | s - | ^ value used here after partial move + | ^ value used here after move error: aborting due to previous error diff --git a/src/test/ui/issues/issue-34721.stderr b/src/test/ui/issues/issue-34721.stderr index 936467fce8277..2ed7b543e713c 100644 --- a/src/test/ui/issues/issue-34721.stderr +++ b/src/test/ui/issues/issue-34721.stderr @@ -13,7 +13,7 @@ LL | x.zero() | - value moved here LL | }; LL | x.zero() - | ^ value used here after partial move + | ^ value used here after move error: aborting due to previous error diff --git a/src/test/ui/moves/moves-based-on-type-tuple.stderr b/src/test/ui/moves/moves-based-on-type-tuple.stderr index bbf88959ebd9d..c49dbdab40210 100644 --- a/src/test/ui/moves/moves-based-on-type-tuple.stderr +++ b/src/test/ui/moves/moves-based-on-type-tuple.stderr @@ -14,7 +14,7 @@ error[E0382]: use of moved value: `x` (Mir) LL | fn dup(x: Box) -> Box<(Box,Box)> { | - move occurs because `x` has type `std::boxed::Box`, which does not implement the `Copy` trait LL | box (x, x) - | - ^ value used here after partial move + | - ^ value used here after move | | | value moved here diff --git a/src/test/ui/nll/closure-access-spans.stderr b/src/test/ui/nll/closure-access-spans.stderr index 67b0fb422e26f..3ca0aefb592e0 100644 --- a/src/test/ui/nll/closure-access-spans.stderr +++ b/src/test/ui/nll/closure-access-spans.stderr @@ -66,7 +66,7 @@ LL | let r = x; LL | || x.len(); //~ ERROR | ^^ - borrow occurs due to use in closure | | - | value borrowed here after partial move + | value borrowed here after move error[E0382]: borrow of moved value: `x` --> $DIR/closure-access-spans.rs:42:5 @@ -78,7 +78,7 @@ LL | let r = x; LL | || x = String::new(); //~ ERROR | ^^ - borrow occurs due to use in closure | | - | value borrowed here after partial move + | value borrowed here after move error[E0382]: borrow of moved value: `x` --> $DIR/closure-access-spans.rs:47:5 @@ -90,7 +90,7 @@ LL | let r = x; LL | || *x = String::new(); //~ ERROR | ^^ - borrow occurs due to use in closure | | - | value borrowed here after partial move + | value borrowed here after move error[E0382]: use of moved value: `x` --> $DIR/closure-access-spans.rs:52:5 @@ -102,7 +102,7 @@ LL | let r = x; LL | || x; //~ ERROR | ^^ - use occurs due to use in closure | | - | value used here after partial move + | value used here after move error: aborting due to 9 previous errors diff --git a/src/test/ui/nll/closure-move-spans.stderr b/src/test/ui/nll/closure-move-spans.stderr index 53f3a8c82e0b5..6750c4047601a 100644 --- a/src/test/ui/nll/closure-move-spans.stderr +++ b/src/test/ui/nll/closure-move-spans.stderr @@ -8,7 +8,7 @@ LL | || x; | | | value moved into closure here LL | let y = x; //~ ERROR - | ^ value used here after partial move + | ^ value used here after move error[E0382]: borrow of moved value: `x` --> $DIR/closure-move-spans.rs:12:13 @@ -20,7 +20,7 @@ LL | || x; | | | value moved into closure here LL | let y = &x; //~ ERROR - | ^^ value borrowed here after partial move + | ^^ value borrowed here after move error[E0382]: borrow of moved value: `x` --> $DIR/closure-move-spans.rs:17:13 @@ -32,7 +32,7 @@ LL | || x; | | | value moved into closure here LL | let y = &mut x; //~ ERROR - | ^^^^^^ value borrowed here after partial move + | ^^^^^^ value borrowed here after move error: aborting due to 3 previous errors diff --git a/src/test/ui/nll/decl-macro-illegal-copy.stderr b/src/test/ui/nll/decl-macro-illegal-copy.stderr index 9e1ba3a4e1bcb..9232ff52393e1 100644 --- a/src/test/ui/nll/decl-macro-illegal-copy.stderr +++ b/src/test/ui/nll/decl-macro-illegal-copy.stderr @@ -5,7 +5,7 @@ LL | $wrapper.inner | -------------- value moved here ... LL | wrapper.inner, - | ^^^^^^^^^^^^^ value used here after partial move + | ^^^^^^^^^^^^^ value used here after move | = note: move occurs because `wrapper.inner` has type `NonCopy`, which does not implement the `Copy` trait diff --git a/src/test/ui/nll/issue-21232-partial-init-and-erroneous-use.stderr b/src/test/ui/nll/issue-21232-partial-init-and-erroneous-use.stderr index 7715c14d7a345..54c728e3d2783 100644 --- a/src/test/ui/nll/issue-21232-partial-init-and-erroneous-use.stderr +++ b/src/test/ui/nll/issue-21232-partial-init-and-erroneous-use.stderr @@ -18,7 +18,7 @@ LL | let mut d = D { x: 0, s: S{ y: 0, z: 0 } }; LL | drop(d); | - value moved here LL | d.x = 10; - | ^^^^^^^^ value assigned here after partial move + | ^^^^^^^^ value assigned here after move error[E0381]: assign to part of possibly uninitialized variable: `d` --> $DIR/issue-21232-partial-init-and-erroneous-use.rs:49:5 diff --git a/src/test/ui/nll/issue-21232-partial-init-and-use.stderr b/src/test/ui/nll/issue-21232-partial-init-and-use.stderr index ac15d9ba26c4d..23da533252cb9 100644 --- a/src/test/ui/nll/issue-21232-partial-init-and-use.stderr +++ b/src/test/ui/nll/issue-21232-partial-init-and-use.stderr @@ -18,7 +18,7 @@ LL | let mut s: S = S::new(); drop(s); | | | move occurs because `s` has type `S>`, which does not implement the `Copy` trait LL | s.x = 10; s.y = Box::new(20); - | ^^^^^^^^ value partially assigned here after partial move + | ^^^^^^^^ value partially assigned here after move error[E0382]: assign to part of moved value: `t` --> $DIR/issue-21232-partial-init-and-use.rs:120:5 @@ -28,7 +28,7 @@ LL | let mut t: T = (0, Box::new(0)); drop(t); | | | move occurs because `t` has type `(u32, std::boxed::Box)`, which does not implement the `Copy` trait LL | t.0 = 10; t.1 = Box::new(20); - | ^^^^^^^^ value partially assigned here after partial move + | ^^^^^^^^ value partially assigned here after move error[E0381]: assign to part of possibly uninitialized variable: `s` --> $DIR/issue-21232-partial-init-and-use.rs:127:5 @@ -50,7 +50,7 @@ LL | let mut s: S = S::new(); drop(s); | | | move occurs because `s` has type `S>`, which does not implement the `Copy` trait LL | s.x = 10; - | ^^^^^^^^ value partially assigned here after partial move + | ^^^^^^^^ value partially assigned here after move error[E0382]: assign to part of moved value: `t` --> $DIR/issue-21232-partial-init-and-use.rs:148:5 @@ -60,7 +60,7 @@ LL | let mut t: T = (0, Box::new(0)); drop(t); | | | move occurs because `t` has type `(u32, std::boxed::Box)`, which does not implement the `Copy` trait LL | t.0 = 10; - | ^^^^^^^^ value partially assigned here after partial move + | ^^^^^^^^ value partially assigned here after move error[E0381]: assign to part of possibly uninitialized variable: `s` --> $DIR/issue-21232-partial-init-and-use.rs:155:5 @@ -159,7 +159,7 @@ LL | match c { LL | c2 => { | -- value moved here LL | c.0 = 2; //~ ERROR assign to part of moved value - | ^^^^^^^ value partially assigned here after partial move + | ^^^^^^^ value partially assigned here after move error[E0382]: assign to part of moved value: `c` --> $DIR/issue-21232-partial-init-and-use.rs:269:13 diff --git a/src/test/ui/try-block/try-block-bad-lifetime.stderr b/src/test/ui/try-block/try-block-bad-lifetime.stderr index 8967e77b5a7cc..b1b925d694ff9 100644 --- a/src/test/ui/try-block/try-block-bad-lifetime.stderr +++ b/src/test/ui/try-block/try-block-bad-lifetime.stderr @@ -32,7 +32,7 @@ LL | Err(k) ?; | - value moved here ... LL | ::std::mem::drop(k); //~ ERROR use of moved value: `k` - | ^ value used here after partial move + | ^ value used here after move error[E0506]: cannot assign to `i` because it is borrowed --> $DIR/try-block-bad-lifetime.rs:32:9 diff --git a/src/test/ui/try-block/try-block-maybe-bad-lifetime.stderr b/src/test/ui/try-block/try-block-maybe-bad-lifetime.stderr index 33561eae46a2a..dafbde6a5150b 100644 --- a/src/test/ui/try-block/try-block-maybe-bad-lifetime.stderr +++ b/src/test/ui/try-block/try-block-maybe-bad-lifetime.stderr @@ -20,7 +20,7 @@ LL | ::std::mem::drop(x); | - value moved here LL | }; LL | println!("{}", x); //~ ERROR borrow of moved value: `x` - | ^ value borrowed here after partial move + | ^ value borrowed here after move error[E0506]: cannot assign to `i` because it is borrowed --> $DIR/try-block-maybe-bad-lifetime.rs:40:9 From 02fe6a7ba6b0d1733c9abbe40ac85c26bba38403 Mon Sep 17 00:00:00 2001 From: Clint Frederickson Date: Wed, 20 Feb 2019 09:54:10 -0700 Subject: [PATCH 7/7] ./x.py test src/test/ui --stage 1 --bless -i --compare-mode=nll --- .../ui/borrowck/borrowck-uninit-field-access.ast.nll.stderr | 2 +- .../moves-based-on-type-cyclic-types-issue-4821.nll.stderr | 2 +- .../ui/moves/moves-based-on-type-match-bindings.nll.stderr | 2 +- src/test/ui/ref-suggestion.nll.stderr | 2 +- src/test/ui/unsized-locals/borrow-after-move.nll.stderr | 6 +++--- src/test/ui/unsized-locals/double-move.nll.stderr | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/test/ui/borrowck/borrowck-uninit-field-access.ast.nll.stderr b/src/test/ui/borrowck/borrowck-uninit-field-access.ast.nll.stderr index bdec94b4f84b0..99cbf64fd5d46 100644 --- a/src/test/ui/borrowck/borrowck-uninit-field-access.ast.nll.stderr +++ b/src/test/ui/borrowck/borrowck-uninit-field-access.ast.nll.stderr @@ -20,7 +20,7 @@ error[E0382]: use of moved value: `line2` LL | let _moved = (line2.origin, line2.middle); | ------------ value moved here LL | line2.consume(); //[ast]~ ERROR use of partially moved value: `line2` [E0382] - | ^^^^^ value used here after move + | ^^^^^ value used here after partial move | = note: move occurs because `line2.middle` has type `Point`, which does not implement the `Copy` trait diff --git a/src/test/ui/moves/moves-based-on-type-cyclic-types-issue-4821.nll.stderr b/src/test/ui/moves/moves-based-on-type-cyclic-types-issue-4821.nll.stderr index 99550235f6969..5f0d2b42671de 100644 --- a/src/test/ui/moves/moves-based-on-type-cyclic-types-issue-4821.nll.stderr +++ b/src/test/ui/moves/moves-based-on-type-cyclic-types-issue-4821.nll.stderr @@ -5,7 +5,7 @@ LL | Some(right) => consume(right), | ----- value moved here ... LL | consume(node) + r //~ ERROR use of partially moved value: `node` - | ^^^^ value used here after move + | ^^^^ value used here after partial move | = note: move occurs because value has type `std::boxed::Box`, which does not implement the `Copy` trait diff --git a/src/test/ui/moves/moves-based-on-type-match-bindings.nll.stderr b/src/test/ui/moves/moves-based-on-type-match-bindings.nll.stderr index 481c492e16469..6d523fc09c08b 100644 --- a/src/test/ui/moves/moves-based-on-type-match-bindings.nll.stderr +++ b/src/test/ui/moves/moves-based-on-type-match-bindings.nll.stderr @@ -5,7 +5,7 @@ LL | Foo {f} => {} | - value moved here ... LL | touch(&x); //~ ERROR use of partially moved value: `x` - | ^^ value borrowed here after move + | ^^ value borrowed here after partial move | = note: move occurs because `x.f` has type `std::string::String`, which does not implement the `Copy` trait diff --git a/src/test/ui/ref-suggestion.nll.stderr b/src/test/ui/ref-suggestion.nll.stderr index bef8dcca921e6..402f3c77cdb7b 100644 --- a/src/test/ui/ref-suggestion.nll.stderr +++ b/src/test/ui/ref-suggestion.nll.stderr @@ -25,7 +25,7 @@ LL | (Some(y), ()) => {}, | - value moved here ... LL | x; //~ ERROR use of partially moved value - | ^ value used here after move + | ^ value used here after partial move | = note: move occurs because value has type `std::vec::Vec`, which does not implement the `Copy` trait diff --git a/src/test/ui/unsized-locals/borrow-after-move.nll.stderr b/src/test/ui/unsized-locals/borrow-after-move.nll.stderr index 0e6a6f6369a15..010e182674b75 100644 --- a/src/test/ui/unsized-locals/borrow-after-move.nll.stderr +++ b/src/test/ui/unsized-locals/borrow-after-move.nll.stderr @@ -5,7 +5,7 @@ LL | let y = *x; | -- value moved here LL | drop_unsized(y); LL | println!("{}", &x); - | ^^ value borrowed here after move + | ^^ value borrowed here after partial 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 move + | ^^ value borrowed here after partial move | = note: move occurs because `*x` has type `str`, which does not implement the `Copy` trait @@ -48,7 +48,7 @@ error[E0382]: borrow of moved value: `x` LL | x.foo(); | - value moved here LL | println!("{}", &x); - | ^^ value borrowed here after move + | ^^ value borrowed here after partial 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.nll.stderr b/src/test/ui/unsized-locals/double-move.nll.stderr index e40289af5ad3d..c0c3e436f535b 100644 --- a/src/test/ui/unsized-locals/double-move.nll.stderr +++ b/src/test/ui/unsized-locals/double-move.nll.stderr @@ -14,7 +14,7 @@ error[E0382]: use of moved value: `x` LL | let _y = *x; | -- value moved here LL | drop_unsized(x); //~ERROR use of moved value - | ^ value used here after move + | ^ value used here after partial move | = note: move occurs because `*x` has type `str`, which does not implement the `Copy` trait