2011-12-19 14:50:31 -06:00
|
|
|
fn main() {
|
|
|
|
let x = ~1;
|
|
|
|
let y = ptr::addr_of(*x) as uint;
|
2012-05-04 14:33:04 -05:00
|
|
|
let lam_copy = fn@(copy x) -> uint { ptr::addr_of(*x) as uint };
|
|
|
|
let lam_move = fn@(move x) -> uint { ptr::addr_of(*x) as uint };
|
2011-12-19 14:50:31 -06:00
|
|
|
assert lam_copy() != y;
|
|
|
|
assert lam_move() == y;
|
|
|
|
|
|
|
|
let x = ~2;
|
|
|
|
let y = ptr::addr_of(*x) as uint;
|
2012-06-30 18:19:07 -05:00
|
|
|
let lam_copy: fn@() -> uint = |copy x| ptr::addr_of(*x) as uint;
|
|
|
|
let lam_move: fn@() -> uint = |move x| ptr::addr_of(*x) as uint;
|
2012-05-04 14:33:04 -05:00
|
|
|
assert lam_copy() != y;
|
|
|
|
assert lam_move() == y;
|
|
|
|
|
|
|
|
let x = ~3;
|
|
|
|
let y = ptr::addr_of(*x) as uint;
|
|
|
|
let snd_copy = fn~(copy x) -> uint { ptr::addr_of(*x) as uint };
|
|
|
|
let snd_move = fn~(move x) -> uint { ptr::addr_of(*x) as uint };
|
2011-12-19 14:50:31 -06:00
|
|
|
assert snd_copy() != y;
|
|
|
|
assert snd_move() == y;
|
2012-05-04 14:33:04 -05:00
|
|
|
|
|
|
|
let x = ~4;
|
|
|
|
let y = ptr::addr_of(*x) as uint;
|
2012-06-30 18:19:07 -05:00
|
|
|
let lam_copy: fn~() -> uint = |copy x| ptr::addr_of(*x) as uint;
|
|
|
|
let lam_move: fn~() -> uint = |move x| ptr::addr_of(*x) as uint;
|
2012-05-04 14:33:04 -05:00
|
|
|
assert lam_copy() != y;
|
|
|
|
assert lam_move() == y;
|
2011-12-19 14:50:31 -06:00
|
|
|
}
|