b18320446e
Everything should now call ptr::addr_of instead of ptr::p2::addr_of. Only the pipes macro code when compiled by stage0 will call ptr::p2::addr_of. Needs a snapshot to get rid of that.
30 lines
1.0 KiB
Rust
30 lines
1.0 KiB
Rust
fn main() {
|
|
let x = ~1;
|
|
let y = ptr::addr_of(&(*x)) as uint;
|
|
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 };
|
|
assert lam_copy() != y;
|
|
assert lam_move() == y;
|
|
|
|
let x = ~2;
|
|
let y = ptr::addr_of(&(*x)) as uint;
|
|
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;
|
|
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 };
|
|
assert snd_copy() != y;
|
|
assert snd_move() == y;
|
|
|
|
let x = ~4;
|
|
let y = ptr::addr_of(&(*x)) as uint;
|
|
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;
|
|
assert lam_copy() != y;
|
|
assert lam_move() == y;
|
|
}
|