rust/tests/ui/stdlib-unit-tests/volatile-fat-ptr.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

16 lines
316 B
Rust
Raw Normal View History

// run-pass
#![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");
}
}