summary refs log tree commit diff
path: root/tests/ui/stdlib-unit-tests/volatile-fat-ptr.rs
blob: ef227a9134dd6356493683c26b04668671d4fb72 (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");
    }
}