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.
This commit is contained in:
parent
8a543ffc76
commit
61c81bf00c
|
@ -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();
|
||||
|
|
Loading…
Reference in New Issue