mirror of
				https://github.com/rust-lang/rust.git
				synced 2025-11-03 22:49:17 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			15 lines
		
	
	
		
			169 B
		
	
	
	
		
			Rust
		
	
	
	
	
	
			
		
		
	
	
			15 lines
		
	
	
		
			169 B
		
	
	
	
		
			Rust
		
	
	
	
	
	
// run-pass
 | 
						|
 | 
						|
union U {
 | 
						|
    a: u8,
 | 
						|
}
 | 
						|
 | 
						|
impl U {
 | 
						|
    fn method(&self) -> u8 { unsafe { self.a } }
 | 
						|
}
 | 
						|
 | 
						|
fn main() {
 | 
						|
    let u = U { a: 10 };
 | 
						|
    assert_eq!(u.method(), 10);
 | 
						|
}
 |