Skip to content

Commit 8a543ff

Browse files
author
Cameron Zwarich
committed
Make borrowck test functions better match their names
A number of borrowck field-sensitivity tests perform more moves and copies than their naming scheme would indicate. This is only necessary for borrowed pointers (to ensure that the borrowws stay alive in the near future when borrow liveness is tracked), but all other test functions should be changed to match their name more closely.
1 parent 53198ff commit 8a543ff

File tree

1 file changed

+8
-18
lines changed

1 file changed

+8
-18
lines changed

src/test/run-pass/borrowck-field-sensitivity.rs

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,13 @@ fn move_after_fu_copy() {
2828
fn fu_move_after_copy() {
2929
let x = A { a: 1, b: box 2 };
3030
drop(x.a);
31-
let y = A { a: 3, .. x };
32-
drop(y.b);
31+
let _y = A { a: 3, .. x };
3332
}
3433

3534
fn fu_move_after_fu_copy() {
3635
let x = A { a: 1, b: box 2 };
3736
let _y = A { b: box 3, .. x };
38-
let z = A { a: 4, .. x };
39-
drop(z.b);
37+
let _z = A { a: 4, .. x };
4038
}
4139

4240
fn copy_after_move() {
@@ -49,7 +47,6 @@ fn copy_after_fu_move() {
4947
let x = A { a: 1, b: box 2 };
5048
let y = A { a: 3, .. x };
5149
drop(x.a);
52-
drop(y.b);
5350
}
5451

5552
fn fu_copy_after_move() {
@@ -60,9 +57,8 @@ fn fu_copy_after_move() {
6057

6158
fn fu_copy_after_fu_move() {
6259
let x = A { a: 1, b: box 2 };
63-
let y = A { a: 3, .. x };
60+
let _y = A { a: 3, .. x };
6461
let _z = A { b: box 3, .. x };
65-
drop(y.b);
6662
}
6763

6864
fn borrow_after_move() {
@@ -73,9 +69,8 @@ fn borrow_after_move() {
7369

7470
fn borrow_after_fu_move() {
7571
let x = A { a: 1, b: box 2 };
76-
let y = A { a: 3, .. x };
72+
let _y = A { a: 3, .. x };
7773
borrow(&x.a);
78-
drop(y.b);
7974
}
8075

8176
fn move_after_borrow() {
@@ -87,8 +82,7 @@ fn move_after_borrow() {
8782
fn fu_move_after_borrow() {
8883
let x = A { a: 1, b: box 2 };
8984
borrow(&x.a);
90-
let y = A { a: 3, .. x };
91-
drop(y.b);
85+
let _y = A { a: 3, .. x };
9286
}
9387

9488
fn mut_borrow_after_mut_borrow() {
@@ -109,7 +103,6 @@ fn move_after_fu_move() {
109103
let x = B { a: box 1, b: box 2 };
110104
let y = B { a: box 3, .. x };
111105
drop(x.a);
112-
drop(y.b);
113106
}
114107

115108
fn fu_move_after_move() {
@@ -121,10 +114,8 @@ fn fu_move_after_move() {
121114

122115
fn fu_move_after_fu_move() {
123116
let x = B { a: box 1, b: box 2 };
124-
let y = B { b: box 3, .. x };
125-
let z = B { a: box 4, .. x };
126-
drop(y.a);
127-
drop(z.b);
117+
let _y = B { b: box 3, .. x };
118+
let _z = B { a: box 4, .. x };
128119
}
129120

130121
fn copy_after_assign_after_move() {
@@ -157,10 +148,9 @@ fn borrow_after_field_assign_after_move() {
157148

158149
fn move_after_assign_after_move() {
159150
let mut x = A { a: 1, b: box 2 };
160-
let y = x.b;
151+
let _y = x.b;
161152
x = A { a: 3, b: box 4 };
162153
drop(x.b);
163-
drop(y);
164154
}
165155

166156
fn move_after_field_assign_after_move() {

0 commit comments

Comments
 (0)