rust/tests/ui/consts/static-raw-pointer-interning.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

16 lines
197 B
Rust
Raw Normal View History

//@ run-pass
static FOO: Foo = Foo {
field: &42 as *const i32,
};
struct Foo {
field: *const i32,
}
unsafe impl Sync for Foo {}
fn main() {
assert_eq!(unsafe { *FOO.field }, 42);
}