]>
Commit | Line | Data |
---|---|---|
e1599b0c XL |
1 | // run-pass |
2 | ||
3 | #[repr(align(4))] | |
4 | struct Foo; | |
5 | ||
6 | static FOO: Foo = Foo; | |
7 | ||
8 | fn main() { | |
9 | let x: &'static () = &(); | |
dfeec247 | 10 | assert_ne!(x as *const () as usize, 1); |
e1599b0c | 11 | let x: &'static Foo = &Foo; |
dfeec247 | 12 | assert_ne!(x as *const Foo as usize, 4); |
e1599b0c XL |
13 | |
14 | // statics must have a unique address | |
15 | assert_ne!(&FOO as *const Foo as usize, 4); | |
16 | ||
dfeec247 XL |
17 | // FIXME this two tests should be assert_eq! |
18 | // this stopped working since we are promoting to constants instead of statics | |
19 | assert_ne!(<Vec<i32>>::new().as_ptr(), <&[i32]>::default().as_ptr()); | |
20 | assert_ne!(<Box<[i32]>>::default().as_ptr(), (&[]).as_ptr()); | |
e1599b0c | 21 | } |