summaryrefslogtreecommitdiffstats
path: root/tests/ui/consts/static-raw-pointer-interning2.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/consts/static-raw-pointer-interning2.rs')
-rw-r--r--tests/ui/consts/static-raw-pointer-interning2.rs15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/ui/consts/static-raw-pointer-interning2.rs b/tests/ui/consts/static-raw-pointer-interning2.rs
new file mode 100644
index 000000000..2b915fd7c
--- /dev/null
+++ b/tests/ui/consts/static-raw-pointer-interning2.rs
@@ -0,0 +1,15 @@
+// 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);
+}