about summary refs log tree commit diff
path: root/library/std/tests/volatile-fat-ptr.rs
blob: b005c12c6187b7ac504704c7c9fd062064b9f212 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#![allow(stable_features)]
#![feature(volatile)]

use std::ptr::{read_volatile, write_volatile};

#[test]
fn volatile_fat_ptr() {
    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");
    }
}