File tree Expand file tree Collapse file tree 3 files changed +5
-2
lines changed Expand file tree Collapse file tree 3 files changed +5
-2
lines changed Original file line number Diff line number Diff line change 11#![ feature( core_intrinsics) ]
22fn main ( ) {
33 // divison of MIN by -1
4- unsafe { std:: intrinsics:: exact_div ( i64:: MIN , -1 ) ; } //~ ERROR result of dividing MIN by -1 cannot be represented
4+ unsafe { std:: intrinsics:: exact_div ( i64:: MIN , -1 ) ; } //~ ERROR overflow in signed remainder ( dividing MIN by -1)
55}
Original file line number Diff line number Diff line change 11#![ feature( core_intrinsics) ]
22fn main ( ) {
33 // MIN/-1 cannot be represented
4- unsafe { std:: intrinsics:: unchecked_div ( i16:: MIN , -1 ) ; } //~ ERROR overflow executing `unchecked_div`
4+ unsafe { std:: intrinsics:: unchecked_div ( i16:: MIN , -1 ) ; } //~ ERROR overflow in signed division (dividing MIN by -1)
55}
Original file line number Diff line number Diff line change @@ -116,6 +116,9 @@ pub fn main() {
116116 assert_eq ! ( 100i8 . wrapping_rem( 10 ) , 0 ) ;
117117 assert_eq ! ( ( -128i8 ) . wrapping_rem( -1 ) , 0 ) ;
118118
119+ assert_eq ! ( i32 :: MIN . wrapping_div( -1 ) , i32 :: MIN ) ;
120+ assert_eq ! ( i32 :: MIN . wrapping_rem( -1 ) , 0 ) ;
121+
119122 assert_eq ! ( 100i8 . wrapping_neg( ) , -100 ) ;
120123 assert_eq ! ( ( -128i8 ) . wrapping_neg( ) , -128 ) ;
121124
You can’t perform that action at this time.
0 commit comments