about summary refs log tree commit diff
path: root/src/test/compile-fail
diff options
context:
space:
mode:
authorP1start <rewi-github@whanau.org>2014-09-13 14:03:34 +1200
committerP1start <rewi-github@whanau.org>2014-10-02 15:51:05 +1300
commit02c6ebde7e9bca72baa0623d9c5f6a86a30ec486 (patch)
treeaef369999c774cb890a03d5b617eee08062339aa /src/test/compile-fail
parent35ff2def5ddc2cf90b1dc5eebcd6a32641a04ea2 (diff)
downloadrust-02c6ebde7e9bca72baa0623d9c5f6a86a30ec486.tar.gz
rust-02c6ebde7e9bca72baa0623d9c5f6a86a30ec486.zip
Change the `use of moved value` error to be more accurate
Previously it output `partially moved` to eagerly. This updates it to be more
accurate and output `collaterally moved` for use of values that were invalidated
by moves out of different fields in the same struct.

Closes #15630.
Diffstat (limited to 'src/test/compile-fail')
-rw-r--r--src/test/compile-fail/borrowck-box-insensitivity.rs15
-rw-r--r--src/test/compile-fail/borrowck-field-sensitivity.rs4
-rw-r--r--src/test/compile-fail/liveness-use-after-move.rs2
-rw-r--r--src/test/compile-fail/use-after-move-self-based-on-type.rs2
-rw-r--r--src/test/compile-fail/use-after-move-self.rs2
5 files changed, 14 insertions, 11 deletions
diff --git a/src/test/compile-fail/borrowck-box-insensitivity.rs b/src/test/compile-fail/borrowck-box-insensitivity.rs
index c9b384e0b00..d05c03547ac 100644
--- a/src/test/compile-fail/borrowck-box-insensitivity.rs
+++ b/src/test/compile-fail/borrowck-box-insensitivity.rs
@@ -31,19 +31,22 @@ struct D {
 fn copy_after_move() {
     let a = box A { x: box 0, y: 1 };
     let _x = a.x;
-    let _y = a.y; //~ ERROR use of partially moved
+    let _y = a.y; //~ ERROR use of moved
+    //~^^ NOTE `a` moved here (through moving `a.x`)
 }
 
 fn move_after_move() {
     let a = box B { x: box 0, y: box 1 };
     let _x = a.x;
-    let _y = a.y; //~ ERROR use of partially moved
+    let _y = a.y; //~ ERROR use of moved
+    //~^^ NOTE `a` moved here (through moving `a.x`)
 }
 
 fn borrow_after_move() {
     let a = box A { x: box 0, y: 1 };
     let _x = a.x;
-    let _y = &a.y; //~ ERROR use of partially moved
+    let _y = &a.y; //~ ERROR use of moved
+    //~^^ NOTE `a` moved here (through moving `a.x`)
 }
 
 fn move_after_borrow() {
@@ -79,19 +82,19 @@ fn mut_borrow_after_borrow() {
 fn copy_after_move_nested() {
     let a = box C { x: box A { x: box 0, y: 1 }, y: 2 };
     let _x = a.x.x;
-    let _y = a.y; //~ ERROR use of partially moved
+    let _y = a.y; //~ ERROR use of collaterally moved
 }
 
 fn move_after_move_nested() {
     let a = box D { x: box A { x: box 0, y: 1 }, y: box 2 };
     let _x = a.x.x;
-    let _y = a.y; //~ ERROR use of partially moved
+    let _y = a.y; //~ ERROR use of collaterally moved
 }
 
 fn borrow_after_move_nested() {
     let a = box C { x: box A { x: box 0, y: 1 }, y: 2 };
     let _x = a.x.x;
-    let _y = &a.y; //~ ERROR use of partially moved
+    let _y = &a.y; //~ ERROR use of collaterally moved
 }
 
 fn move_after_borrow_nested() {
diff --git a/src/test/compile-fail/borrowck-field-sensitivity.rs b/src/test/compile-fail/borrowck-field-sensitivity.rs
index 72042b8373d..49c93e3aa9e 100644
--- a/src/test/compile-fail/borrowck-field-sensitivity.rs
+++ b/src/test/compile-fail/borrowck-field-sensitivity.rs
@@ -13,13 +13,13 @@ struct A { a: int, b: Box<int> }
 fn deref_after_move() {
     let x = A { a: 1, b: box 2 };
     drop(x.b);
-    drop(*x.b); //~ ERROR use of partially moved value: `*x.b`
+    drop(*x.b); //~ ERROR use of moved value: `*x.b`
 }
 
 fn deref_after_fu_move() {
     let x = A { a: 1, b: box 2 };
     let y = A { a: 3, .. x };
-    drop(*x.b); //~ ERROR use of partially moved value: `*x.b`
+    drop(*x.b); //~ ERROR use of moved value: `*x.b`
 }
 
 fn borrow_after_move() {
diff --git a/src/test/compile-fail/liveness-use-after-move.rs b/src/test/compile-fail/liveness-use-after-move.rs
index 0b8e65fee08..cd7401a65ae 100644
--- a/src/test/compile-fail/liveness-use-after-move.rs
+++ b/src/test/compile-fail/liveness-use-after-move.rs
@@ -13,6 +13,6 @@ extern crate debug;
 fn main() {
     let x = box 5i;
     let y = x;
-    println!("{:?}", *x); //~ ERROR use of partially moved value: `*x`
+    println!("{:?}", *x); //~ ERROR use of moved value: `*x`
     y.clone();
 }
diff --git a/src/test/compile-fail/use-after-move-self-based-on-type.rs b/src/test/compile-fail/use-after-move-self-based-on-type.rs
index b11650a6a4f..a1b7f83da2f 100644
--- a/src/test/compile-fail/use-after-move-self-based-on-type.rs
+++ b/src/test/compile-fail/use-after-move-self-based-on-type.rs
@@ -19,7 +19,7 @@ impl Drop for S {
 impl S {
     pub fn foo(self) -> int {
         self.bar();
-        return self.x;  //~ ERROR use of partially moved value: `self.x`
+        return self.x;  //~ ERROR use of moved value: `self.x`
     }
 
     pub fn bar(self) {}
diff --git a/src/test/compile-fail/use-after-move-self.rs b/src/test/compile-fail/use-after-move-self.rs
index 22c3ec7c341..607d6163208 100644
--- a/src/test/compile-fail/use-after-move-self.rs
+++ b/src/test/compile-fail/use-after-move-self.rs
@@ -16,7 +16,7 @@ struct S {
 impl S {
     pub fn foo(self) -> int {
         self.bar();
-        return *self.x;  //~ ERROR use of partially moved value: `*self.x`
+        return *self.x;  //~ ERROR use of moved value: `*self.x`
     }
 
     pub fn bar(self) {}