diff options
Diffstat (limited to 'tests/ui/consts/static-raw-pointer-interning.rs')
| -rw-r--r-- | tests/ui/consts/static-raw-pointer-interning.rs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/ui/consts/static-raw-pointer-interning.rs b/tests/ui/consts/static-raw-pointer-interning.rs new file mode 100644 index 00000000000..cab60c91e16 --- /dev/null +++ b/tests/ui/consts/static-raw-pointer-interning.rs @@ -0,0 +1,15 @@ +// 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); +} |
