about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/test/ui/consts/issue-90762.rs26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/test/ui/consts/issue-90762.rs b/src/test/ui/consts/issue-90762.rs
new file mode 100644
index 00000000000..ef7c7deb62f
--- /dev/null
+++ b/src/test/ui/consts/issue-90762.rs
@@ -0,0 +1,26 @@
+// run-pass
+#![allow(unreachable_code)]
+
+use std::sync::atomic::{AtomicBool, Ordering};
+
+struct Print(usize);
+
+impl Drop for Print {
+    fn drop(&mut self) {
+        FOO[self.0].store(true, Ordering::Relaxed);
+    }
+}
+
+const A: Print = Print(0);
+const B: Print = Print(1);
+
+static FOO: [AtomicBool; 3] = [AtomicBool::new(false), AtomicBool::new(false), AtomicBool::new(false)];
+
+fn main() {
+    loop {
+        std::mem::forget(({A}, B, Print(2), break));
+    }
+    for (i, b) in FOO.iter().enumerate() {
+        assert!(b.load(Ordering::Relaxed), "{} not set", i);
+    }
+}
\ No newline at end of file