mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-30 02:33:55 +00:00
16 lines
234 B
Rust
16 lines
234 B
Rust
|
//@ run-pass
|
||
|
|
||
|
static mut FOO: Foo = Foo {
|
||
|
field: &mut [42] as *mut [i32] as *mut i32,
|
||
|
};
|
||
|
|
||
|
struct Foo {
|
||
|
field: *mut i32,
|
||
|
}
|
||
|
|
||
|
unsafe impl Sync for Foo {}
|
||
|
|
||
|
fn main() {
|
||
|
assert_eq!(unsafe { *FOO.field = 69; *FOO.field }, 69);
|
||
|
}
|