mirror of
				https://github.com/rust-lang/rust.git
				synced 2025-10-28 11:38:01 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			16 lines
		
	
	
		
			197 B
		
	
	
	
		
			Rust
		
	
	
	
	
	
			
		
		
	
	
			16 lines
		
	
	
		
			197 B
		
	
	
	
		
			Rust
		
	
	
	
	
	
| //@ run-pass
 | |
| 
 | |
| static FOO: Foo = Foo {
 | |
|     field: &42 as *const i32,
 | |
| };
 | |
| 
 | |
| struct Foo {
 | |
|     field: *const i32,
 | |
| }
 | |
| 
 | |
| unsafe impl Sync for Foo {}
 | |
| 
 | |
| fn main() {
 | |
|     assert_eq!(unsafe { *FOO.field }, 42);
 | |
| }
 | 
