Skip to content

Commit f8f8028

Browse files
committed
---
yaml --- r: 117630 b: refs/heads/auto c: 01eb0ce h: refs/heads/master v: v3
1 parent 8f0247d commit f8f8028

File tree

4 files changed

+135
-86
lines changed

4 files changed

+135
-86
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0
1313
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
1414
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1515
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
16-
refs/heads/auto: cc28ae5201b0927683b253dbe893a62a188aa5a5
16+
refs/heads/auto: 01eb0ce1227e3c7c2c32832508ea2930bd2cbb62
1717
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
1818
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c
1919
refs/tags/0.1: b19db808c2793fe2976759b85a355c3ad8c8b336

branches/auto/src/librustdoc/html/static/playpen.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
a.attr('target', '_blank');
2323
$(this).append(a);
2424
}, function() {
25-
$(this).find('a').remove();
25+
$(this).find('a.test-arrow').remove();
2626
});
2727
}
2828
}());

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

Lines changed: 38 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,13 @@
1010

1111
struct A { a: int, b: Box<int> }
1212

13-
fn borrow<T>(_: &T) { }
14-
15-
fn use_after_move() {
13+
fn deref_after_move() {
1614
let x = A { a: 1, b: box 2 };
1715
drop(x.b);
1816
drop(*x.b); //~ ERROR use of partially moved value: `*x.b`
1917
}
2018

21-
fn use_after_fu_move() {
19+
fn deref_after_fu_move() {
2220
let x = A { a: 1, b: box 2 };
2321
let y = A { a: 3, .. x };
2422
drop(*x.b); //~ ERROR use of partially moved value: `*x.b`
@@ -27,35 +25,37 @@ fn use_after_fu_move() {
2725
fn borrow_after_move() {
2826
let x = A { a: 1, b: box 2 };
2927
drop(x.b);
30-
borrow(&x.b); //~ ERROR use of moved value: `x.b`
28+
let p = &x.b; //~ ERROR use of moved value: `x.b`
29+
drop(**p);
3130
}
3231

3332
fn borrow_after_fu_move() {
3433
let x = A { a: 1, b: box 2 };
3534
let _y = A { a: 3, .. x };
36-
borrow(&x.b); //~ ERROR use of moved value: `x.b`
35+
let p = &x.b; //~ ERROR use of moved value: `x.b`
36+
drop(**p);
3737
}
3838

3939
fn move_after_borrow() {
4040
let x = A { a: 1, b: box 2 };
41-
let y = &x.b;
41+
let p = &x.b;
4242
drop(x.b); //~ ERROR cannot move out of `x.b` because it is borrowed
43-
borrow(&*y);
43+
drop(**p);
4444
}
4545

4646
fn fu_move_after_borrow() {
4747
let x = A { a: 1, b: box 2 };
48-
let y = &x.b;
49-
let _z = A { a: 3, .. x }; //~ ERROR cannot move out of `x.b` because it is borrowed
50-
borrow(&*y);
48+
let p = &x.b;
49+
let _y = A { a: 3, .. x }; //~ ERROR cannot move out of `x.b` because it is borrowed
50+
drop(**p);
5151
}
5252

5353
fn mut_borrow_after_mut_borrow() {
5454
let mut x = A { a: 1, b: box 2 };
55-
let y = &mut x.a;
56-
let z = &mut x.a; //~ ERROR cannot borrow `x.a` as mutable more than once at a time
57-
drop(*y);
58-
drop(*z);
55+
let p = &mut x.a;
56+
let q = &mut x.a; //~ ERROR cannot borrow `x.a` as mutable more than once at a time
57+
drop(*p);
58+
drop(*q);
5959
}
6060

6161
fn move_after_move() {
@@ -84,7 +84,21 @@ 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 move_after_borrow_correct() {
88+
let x = A { a: 1, b: box 2 };
89+
let p = &x.a;
90+
drop(x.b); //~ ERROR cannot move out of `x.b` because it is borrowed
91+
drop(*p);
92+
}
93+
94+
fn fu_move_after_borrow_correct() {
95+
let x = A { a: 1, b: box 2 };
96+
let p = &x.a;
97+
let _y = A { a: 3, .. x }; //~ ERROR cannot move out of `x.b` because it is borrowed
98+
drop(*p);
99+
}
100+
101+
fn copy_after_field_assign_after_uninit() {
88102
let mut x: A;
89103
x.a = 1;
90104
drop(x.a); //~ ERROR use of possibly uninitialized variable: `x.a`
@@ -93,7 +107,8 @@ fn use_after_field_assign_after_uninit() {
93107
fn borrow_after_field_assign_after_uninit() {
94108
let mut x: A;
95109
x.a = 1;
96-
borrow(&x.a); //~ ERROR use of possibly uninitialized variable: `x.a`
110+
let p = &x.a; //~ ERROR use of possibly uninitialized variable: `x.a`
111+
drop(*p);
97112
}
98113

99114
fn move_after_field_assign_after_uninit() {
@@ -103,8 +118,8 @@ fn move_after_field_assign_after_uninit() {
103118
}
104119

105120
fn main() {
106-
use_after_move();
107-
use_after_fu_move();
121+
deref_after_move();
122+
deref_after_fu_move();
108123

109124
borrow_after_move();
110125
borrow_after_fu_move();
@@ -117,7 +132,10 @@ fn main() {
117132
fu_move_after_move();
118133
fu_move_after_fu_move();
119134

120-
use_after_field_assign_after_uninit();
135+
move_after_borrow_correct();
136+
fu_move_after_borrow_correct();
137+
138+
copy_after_field_assign_after_uninit();
121139
borrow_after_field_assign_after_uninit();
122140
move_after_field_assign_after_uninit();
123141
}

0 commit comments

Comments
 (0)