summaryrefslogtreecommitdiffstats
path: root/tests/ui/stdlib-unit-tests/volatile-fat-ptr.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/stdlib-unit-tests/volatile-fat-ptr.rs')
-rw-r--r--tests/ui/stdlib-unit-tests/volatile-fat-ptr.rs15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/ui/stdlib-unit-tests/volatile-fat-ptr.rs b/tests/ui/stdlib-unit-tests/volatile-fat-ptr.rs
new file mode 100644
index 000000000..f73e7e1c3
--- /dev/null
+++ b/tests/ui/stdlib-unit-tests/volatile-fat-ptr.rs
@@ -0,0 +1,15 @@
+// run-pass
+
+#![allow(stable_features)]
+#![feature(volatile)]
+use std::ptr::{read_volatile, write_volatile};
+
+fn main() {
+ let mut x: &'static str = "test";
+ unsafe {
+ let a = read_volatile(&x);
+ assert_eq!(a, "test");
+ write_volatile(&mut x, "foo");
+ assert_eq!(x, "foo");
+ }
+}