blob: 84c2b3acf35800f9ea7759b7cb8250ac68a09ac9 [file] [log] [blame]
// exec-env:RUST_POISON_ON_FREE=1
// Test argument patterns where we create refs to the inside of `~`
// boxes. Make sure that we don't free the box as we match the
// pattern.
fn getaddr(~ref x: ~uint) -> *uint {
let addr: *uint = &*x;
addr
}
fn checkval(~ref x: ~uint) -> uint {
*x
}
fn main() {
let obj = ~1;
let objptr: *uint = &*obj;
let xptr = getaddr(obj);
assert_eq!(objptr, xptr);
let obj = ~22;
assert_eq!(checkval(obj), 22);
}