Skip to content

Commit 53198ff

Browse files
author
Cameron Zwarich
committed
Mention the specific kind of use in borrowck test function names
Some of the borrowck field-sensitivity test functions have 'use' in their name, but they don't refer to the specific kind of use (whether a copy or a deref). It would be better if the name more precisely reflected what the function is testing.
1 parent 61d7917 commit 53198ff

File tree

2 files changed

+28
-28
lines changed

2 files changed

+28
-28
lines changed

src/test/compile-fail/borrowck-field-sensitivity.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ struct A { a: int, b: Box<int> }
1212

1313
fn borrow<T>(_: &T) { }
1414

15-
fn use_after_move() {
15+
fn deref_after_move() {
1616
let x = A { a: 1, b: box 2 };
1717
drop(x.b);
1818
drop(*x.b); //~ ERROR use of partially moved value: `*x.b`
1919
}
2020

21-
fn use_after_fu_move() {
21+
fn deref_after_fu_move() {
2222
let x = A { a: 1, b: box 2 };
2323
let y = A { a: 3, .. x };
2424
drop(*x.b); //~ ERROR use of partially moved value: `*x.b`
@@ -84,7 +84,7 @@ fn fu_move_after_fu_move() {
8484

8585
// The following functions aren't yet accepted, but they should be.
8686

87-
fn use_after_field_assign_after_uninit() {
87+
fn copy_after_field_assign_after_uninit() {
8888
let mut x: A;
8989
x.a = 1;
9090
drop(x.a); //~ ERROR use of possibly uninitialized variable: `x.a`
@@ -103,8 +103,8 @@ fn move_after_field_assign_after_uninit() {
103103
}
104104

105105
fn main() {
106-
use_after_move();
107-
use_after_fu_move();
106+
deref_after_move();
107+
deref_after_fu_move();
108108

109109
borrow_after_move();
110110
borrow_after_fu_move();
@@ -117,7 +117,7 @@ fn main() {
117117
fu_move_after_move();
118118
fu_move_after_fu_move();
119119

120-
use_after_field_assign_after_uninit();
120+
copy_after_field_assign_after_uninit();
121121
borrow_after_field_assign_after_uninit();
122122
move_after_field_assign_after_uninit();
123123
}

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

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -13,52 +13,52 @@ struct B { a: Box<int>, b: Box<int> }
1313

1414
fn borrow<T>(_: &T) { }
1515

16-
fn move_after_use() {
16+
fn move_after_copy() {
1717
let x = A { a: 1, b: box 2 };
1818
drop(x.a);
1919
drop(x.b);
2020
}
2121

22-
fn move_after_fu_use() {
22+
fn move_after_fu_copy() {
2323
let x = A { a: 1, b: box 2 };
2424
let _y = A { b: box 3, .. x };
2525
drop(x.b);
2626
}
2727

28-
fn fu_move_after_use() {
28+
fn fu_move_after_copy() {
2929
let x = A { a: 1, b: box 2 };
3030
drop(x.a);
3131
let y = A { a: 3, .. x };
3232
drop(y.b);
3333
}
3434

35-
fn fu_move_after_fu_use() {
35+
fn fu_move_after_fu_copy() {
3636
let x = A { a: 1, b: box 2 };
3737
let _y = A { b: box 3, .. x };
3838
let z = A { a: 4, .. x };
3939
drop(z.b);
4040
}
4141

42-
fn use_after_move() {
42+
fn copy_after_move() {
4343
let x = A { a: 1, b: box 2 };
4444
drop(x.b);
4545
drop(x.a);
4646
}
4747

48-
fn use_after_fu_move() {
48+
fn copy_after_fu_move() {
4949
let x = A { a: 1, b: box 2 };
5050
let y = A { a: 3, .. x };
5151
drop(x.a);
5252
drop(y.b);
5353
}
5454

55-
fn fu_use_after_move() {
55+
fn fu_copy_after_move() {
5656
let x = A { a: 1, b: box 2 };
5757
drop(x.b);
5858
let _y = A { b: box 3, .. x };
5959
}
6060

61-
fn fu_use_after_fu_move() {
61+
fn fu_copy_after_fu_move() {
6262
let x = A { a: 1, b: box 2 };
6363
let y = A { a: 3, .. x };
6464
let _z = A { b: box 3, .. x };
@@ -127,14 +127,14 @@ fn fu_move_after_fu_move() {
127127
drop(z.b);
128128
}
129129

130-
fn use_after_assign_after_move() {
130+
fn copy_after_assign_after_move() {
131131
let mut x = A { a: 1, b: box 2 };
132132
drop(x.b);
133133
x = A { a: 3, b: box 4 };
134134
drop(*x.b);
135135
}
136136

137-
fn use_after_field_assign_after_move() {
137+
fn copy_after_field_assign_after_move() {
138138
let mut x = A { a: 1, b: box 2 };
139139
drop(x.b);
140140
x.b = box 3;
@@ -170,7 +170,7 @@ fn move_after_field_assign_after_move() {
170170
drop(x.b);
171171
}
172172

173-
fn use_after_assign_after_uninit() {
173+
fn copy_after_assign_after_uninit() {
174174
let mut x: A;
175175
x = A { a: 1, b: box 2 };
176176
drop(x.a);
@@ -189,14 +189,14 @@ fn move_after_assign_after_uninit() {
189189
}
190190

191191
fn main() {
192-
move_after_use();
193-
move_after_fu_use();
194-
fu_move_after_use();
195-
fu_move_after_fu_use();
196-
use_after_move();
197-
use_after_fu_move();
198-
fu_use_after_move();
199-
fu_use_after_fu_move();
192+
move_after_copy();
193+
move_after_fu_copy();
194+
fu_move_after_copy();
195+
fu_move_after_fu_copy();
196+
copy_after_move();
197+
copy_after_fu_move();
198+
fu_copy_after_move();
199+
fu_copy_after_fu_move();
200200

201201
borrow_after_move();
202202
borrow_after_fu_move();
@@ -209,14 +209,14 @@ fn main() {
209209
fu_move_after_move();
210210
fu_move_after_fu_move();
211211

212-
use_after_assign_after_move();
213-
use_after_field_assign_after_move();
212+
copy_after_assign_after_move();
213+
copy_after_field_assign_after_move();
214214
borrow_after_assign_after_move();
215215
borrow_after_field_assign_after_move();
216216
move_after_assign_after_move();
217217
move_after_field_assign_after_move();
218218

219-
use_after_assign_after_uninit();
219+
copy_after_assign_after_uninit();
220220
borrow_after_assign_after_uninit();
221221
move_after_assign_after_uninit();
222222
}

0 commit comments

Comments
 (0)