mirror of
				https://github.com/rust-lang/rust.git
				synced 2025-10-25 14:41:47 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			16 lines
		
	
	
		
			324 B
		
	
	
	
		
			Rust
		
	
	
	
	
	
			
		
		
	
	
			16 lines
		
	
	
		
			324 B
		
	
	
	
		
			Rust
		
	
	
	
	
	
| #![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");
 | |
|     }
 | |
| }
 | 
