about summary refs log tree commit diff
path: root/src/test/run-pass/volatile-fat-ptr.rs
blob: f01263b73a9fcf505fd037f87ceeb7722bb481c1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
#![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");
    }
}