2019-07-27 00:54:25 +03:00
|
|
|
// run-pass
|
|
|
|
|
2018-09-14 12:20:28 +02:00
|
|
|
#![allow(stable_features)]
|
2016-03-19 02:18:33 +00:00
|
|
|
#![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");
|
|
|
|
}
|
|
|
|
}
|