about summary refs log tree commit diff
diff options
context:
space:
mode:
authorCameron Zwarich <zwarich@mozilla.com>2014-06-07 00:44:01 -0700
committerCameron Zwarich <zwarich@mozilla.com>2014-06-07 02:31:01 -0700
commit61c81bf00cc8f8a87940fce3ba7be0bfd66cf04f (patch)
tree6bfd04c6d317a94e47c50d451d010f8d6f509fc8
parent8a543ffc76eea08db59cffbd6f8be7926bdb78c2 (diff)
downloadrust-61c81bf00cc8f8a87940fce3ba7be0bfd66cf04f.tar.gz
rust-61c81bf00cc8f8a87940fce3ba7be0bfd66cf04f.zip
Add more borrowck tests for functional update moves
Add more borrowck field-sensitivity tests for functional update moves.
This makes the collection of test functions more combinatorially
exhaustive.
-rw-r--r--src/test/run-pass/borrowck-field-sensitivity.rs50
1 files changed, 50 insertions, 0 deletions
diff --git a/src/test/run-pass/borrowck-field-sensitivity.rs b/src/test/run-pass/borrowck-field-sensitivity.rs
index 202df70f5d2..7f9a1427d72 100644
--- a/src/test/run-pass/borrowck-field-sensitivity.rs
+++ b/src/test/run-pass/borrowck-field-sensitivity.rs
@@ -125,6 +125,13 @@ fn copy_after_assign_after_move() {
     drop(*x.b);
 }
 
+fn copy_after_assign_after_fu_move() {
+    let mut x = A { a: 1, b: box 2 };
+    let _y = A { a: 3, .. x };
+    x = A { a: 3, b: box 4 };
+    drop(*x.b);
+}
+
 fn copy_after_field_assign_after_move() {
     let mut x = A { a: 1, b: box 2 };
     drop(x.b);
@@ -132,6 +139,13 @@ fn copy_after_field_assign_after_move() {
     drop(*x.b);
 }
 
+fn copy_after_field_assign_after_fu_move() {
+    let mut x = A { a: 1, b: box 2 };
+    let _y = A { a: 3, .. x };
+    x.b = box 3;
+    drop(*x.b);
+}
+
 fn borrow_after_assign_after_move() {
     let mut x = A { a: 1, b: box 2 };
     drop(x.b);
@@ -139,6 +153,13 @@ fn borrow_after_assign_after_move() {
     borrow(&x.b);
 }
 
+fn borrow_after_assign_after_fu_move() {
+    let mut x = A { a: 1, b: box 2 };
+    let _y = A { a: 3, .. x };
+    x = A { a: 3, b: box 4 };
+    borrow(&x.b);
+}
+
 fn borrow_after_field_assign_after_move() {
     let mut x = A { a: 1, b: box 2 };
     drop(x.b);
@@ -146,6 +167,13 @@ fn borrow_after_field_assign_after_move() {
     borrow(&x.b);
 }
 
+fn borrow_after_field_assign_after_fu_move() {
+    let mut x = A { a: 1, b: box 2 };
+    let _y = A { a: 3, .. x };
+    x.b = box 3;
+    borrow(&x.b);
+}
+
 fn move_after_assign_after_move() {
     let mut x = A { a: 1, b: box 2 };
     let _y = x.b;
@@ -153,6 +181,13 @@ fn move_after_assign_after_move() {
     drop(x.b);
 }
 
+fn move_after_assign_after_fu_move() {
+    let mut x = A { a: 1, b: box 2 };
+    let _y = A { a: 3, .. x };
+    x = A { a: 3, b: box 4 };
+    drop(x.b);
+}
+
 fn move_after_field_assign_after_move() {
     let mut x = A { a: 1, b: box 2 };
     drop(x.b);
@@ -160,6 +195,13 @@ fn move_after_field_assign_after_move() {
     drop(x.b);
 }
 
+fn move_after_field_assign_after_fu_move() {
+    let mut x = A { a: 1, b: box 2 };
+    let _y = A { a: 3, .. x };
+    x.b = box 3;
+    drop(x.b);
+}
+
 fn copy_after_assign_after_uninit() {
     let mut x: A;
     x = A { a: 1, b: box 2 };
@@ -200,11 +242,19 @@ fn main() {
     fu_move_after_fu_move();
 
     copy_after_assign_after_move();
+    copy_after_assign_after_fu_move();
     copy_after_field_assign_after_move();
+    copy_after_field_assign_after_fu_move();
+
     borrow_after_assign_after_move();
+    borrow_after_assign_after_fu_move();
     borrow_after_field_assign_after_move();
+    borrow_after_field_assign_after_fu_move();
+
     move_after_assign_after_move();
+    move_after_assign_after_fu_move();
     move_after_field_assign_after_move();
+    move_after_field_assign_after_fu_move();
 
     copy_after_assign_after_uninit();
     borrow_after_assign_after_uninit();