Skip to content

Commit b4ba0af

Browse files
committed
---
yaml --- r: 15803 b: refs/heads/try c: efa2252 h: refs/heads/master i: 15801: 7a8873e 15799: 7181287 v: v3
1 parent cc11e4a commit b4ba0af

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
refs/heads/master: 61b1875c16de39c166b0f4d54bba19f9c6777d1a
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 4a81779abd786ff22d71434c6d9a5917ea4cdfff
5-
refs/heads/try: be48cd87dcdaaf224a7f4338d7ab450119d1b00e
5+
refs/heads/try: efa2252cfcabe6aec34861d06fa10d0c174b8556
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// compile-flags:--borrowck=err
2+
// exec-env:RUST_POISON_ON_FREE=1
3+
4+
fn borrow(x: &int, f: fn(x: &int)) {
5+
let before = *x;
6+
f(x);
7+
let after = *x;
8+
assert before == after;
9+
}
10+
11+
fn main() {
12+
let mut x = @3;
13+
borrow(x) {|b_x|
14+
assert *b_x == 3;
15+
assert ptr::addr_of(*x) == ptr::addr_of(*b_x);
16+
x = @22;
17+
18+
#debug["ptr::addr_of(*b_x) = %x", ptr::addr_of(*b_x) as uint];
19+
assert *b_x == 3;
20+
assert ptr::addr_of(*x) != ptr::addr_of(*b_x);
21+
}
22+
}

0 commit comments

Comments
 (0)