2012-12-10 19:32:48 -06:00
|
|
|
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
|
|
|
|
// file at the top-level directory of this distribution and at
|
|
|
|
// http://rust-lang.org/COPYRIGHT.
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
|
|
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
|
|
// option. This file may not be copied, modified, or distributed
|
|
|
|
// except according to those terms.
|
|
|
|
|
2012-05-17 22:18:20 -05:00
|
|
|
// exec-env:RUST_POISON_ON_FREE=1
|
|
|
|
|
2013-01-26 00:46:32 -06:00
|
|
|
struct F { f: ~int }
|
|
|
|
|
2012-05-17 22:18:20 -05:00
|
|
|
fn main() {
|
2013-01-26 00:46:32 -06:00
|
|
|
let mut x = @mut @F {f: ~3};
|
2012-08-06 14:34:08 -05:00
|
|
|
match x {
|
2013-01-26 00:46:32 -06:00
|
|
|
@@F{f: ref b_x} => {
|
2012-12-08 00:42:49 -06:00
|
|
|
assert **b_x == 3;
|
|
|
|
assert ptr::addr_of(&(x.f)) == ptr::addr_of(b_x);
|
2012-05-17 22:18:20 -05:00
|
|
|
|
2013-01-26 00:46:32 -06:00
|
|
|
*x = @F {f: ~4};
|
2012-05-17 22:18:20 -05:00
|
|
|
|
2012-12-08 00:42:49 -06:00
|
|
|
debug!("ptr::addr_of(*b_x) = %x", ptr::addr_of(&(**b_x)) as uint);
|
|
|
|
assert **b_x == 3;
|
|
|
|
assert ptr::addr_of(&(*x.f)) != ptr::addr_of(&(**b_x));
|
2012-05-17 22:18:20 -05:00
|
|
|
}
|
|
|
|
}
|
2012-05-18 15:50:56 -05:00
|
|
|
}
|