File tree Expand file tree Collapse file tree 2 files changed +23
-1
lines changed
branches/try/src/test/run-pass Expand file tree Collapse file tree 2 files changed +23
-1
lines changed Original file line number Diff line number Diff line change 2
2
refs/heads/master: 61b1875c16de39c166b0f4d54bba19f9c6777d1a
3
3
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4
4
refs/heads/snap-stage3: 4a81779abd786ff22d71434c6d9a5917ea4cdfff
5
- refs/heads/try: be48cd87dcdaaf224a7f4338d7ab450119d1b00e
5
+ refs/heads/try: efa2252cfcabe6aec34861d06fa10d0c174b8556
6
6
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
Original file line number Diff line number Diff line change
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
+ }
You can’t perform that action at this time.
0 commit comments