Skip to content

Commit 08bd44d

Browse files
committed
---
yaml --- r: 152363 b: refs/heads/try2 c: 01eb0ce h: refs/heads/master i: 152361: 27ed0d5 152359: 5985d3a v: v3
1 parent 27197af commit 08bd44d

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
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: cc28ae5201b0927683b253dbe893a62a188aa5a5
8+
refs/heads/try2: 01eb0ce1227e3c7c2c32832508ea2930bd2cbb62
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/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/try2/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)