summaryrefslogtreecommitdiffstats
path: root/tests/ui/stdlib-unit-tests/volatile-fat-ptr.rs
blob: f73e7e1c39121f8b5a41e6c14a29d530b67eceb9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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");
    }
}