mirror of
				https://github.com/rust-lang/rust.git
				synced 2025-11-04 06:56:14 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			23 lines
		
	
	
		
			422 B
		
	
	
	
		
			Rust
		
	
	
	
	
	
			
		
		
	
	
			23 lines
		
	
	
		
			422 B
		
	
	
	
		
			Rust
		
	
	
	
	
	
//@ known-bug: #97501
 | 
						|
 | 
						|
#![feature(core_intrinsics)]
 | 
						|
use std::intrinsics::wrapping_add;
 | 
						|
 | 
						|
#[derive(Clone, Copy)]
 | 
						|
struct WrapInt8 {
 | 
						|
    value: u8
 | 
						|
}
 | 
						|
 | 
						|
impl std::ops::Add for WrapInt8 {
 | 
						|
    type Output = WrapInt8;
 | 
						|
    fn add(self, other: WrapInt8) -> WrapInt8 {
 | 
						|
        wrapping_add(self, other)
 | 
						|
    }
 | 
						|
}
 | 
						|
 | 
						|
fn main() {
 | 
						|
    let p = WrapInt8 { value: 123 };
 | 
						|
    let q = WrapInt8 { value: 234 };
 | 
						|
    println!("{}", (p + q).value);
 | 
						|
}
 |