File tree 3 files changed +5
-2
lines changed
3 files changed +5
-2
lines changed Original file line number Diff line number Diff line change 1
1
#![ feature( core_intrinsics) ]
2
2
fn main ( ) {
3
3
// 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)
5
5
}
Original file line number Diff line number Diff line change 1
1
#![ feature( core_intrinsics) ]
2
2
fn main ( ) {
3
3
// 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)
5
5
}
Original file line number Diff line number Diff line change @@ -116,6 +116,9 @@ pub fn main() {
116
116
assert_eq ! ( 100i8 . wrapping_rem( 10 ) , 0 ) ;
117
117
assert_eq ! ( ( -128i8 ) . wrapping_rem( -1 ) , 0 ) ;
118
118
119
+ assert_eq ! ( i32 :: MIN . wrapping_div( -1 ) , i32 :: MIN ) ;
120
+ assert_eq ! ( i32 :: MIN . wrapping_rem( -1 ) , 0 ) ;
121
+
119
122
assert_eq ! ( 100i8 . wrapping_neg( ) , -100 ) ;
120
123
assert_eq ! ( ( -128i8 ) . wrapping_neg( ) , -128 ) ;
121
124
You can’t perform that action at this time.
0 commit comments