rust/src/test/auxiliary/xcrate_static_addresses.rs
2014-06-28 11:53:58 -07:00

31 lines
905 B
Rust

// Copyright 2013 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.
#[inline(never)]
pub static global: int = 3;
#[inline(never)]
static global0: int = 4;
#[inline(never)]
pub static global2: &'static int = &global0;
pub fn verify_same(a: &'static int) {
let a = a as *const int as uint;
let b = &global as *const int as uint;
assert_eq!(a, b);
}
pub fn verify_same2(a: &'static int) {
let a = a as *const int as uint;
let b = global2 as *const int as uint;
assert_eq!(a, b);
}