]> git.proxmox.com Git - rustc.git/blob - tests/ui/stdlib-unit-tests/volatile-fat-ptr.rs
New upstream version 1.68.2+dfsg1
[rustc.git] / tests / ui / stdlib-unit-tests / volatile-fat-ptr.rs
1 // run-pass
2
3 #![allow(stable_features)]
4 #![feature(volatile)]
5 use std::ptr::{read_volatile, write_volatile};
6
7 fn main() {
8 let mut x: &'static str = "test";
9 unsafe {
10 let a = read_volatile(&x);
11 assert_eq!(a, "test");
12 write_volatile(&mut x, "foo");
13 assert_eq!(x, "foo");
14 }
15 }