diff options
| author | bors <bors@rust-lang.org> | 2015-03-03 14:18:03 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2015-03-03 14:18:03 +0000 |
| commit | 14f0942a49b77f81d0bedb3d8b5fb615ef521bb3 (patch) | |
| tree | fa3cabf0f4e563a1b4f9e40fafa4855e905fd8e7 /src/libcoretest | |
| parent | 38e97b99a6b133cb4c621c68e75b28abc6c617c1 (diff) | |
| parent | 243c5164ea32b38c4ac44fdd5e0ceb2da45c283f (diff) | |
| download | rust-14f0942a49b77f81d0bedb3d8b5fb615ef521bb3.tar.gz rust-14f0942a49b77f81d0bedb3d8b5fb615ef521bb3.zip | |
Auto merge of #22532 - pnkfelix:arith-overflow, r=pnkfelix,eddyb
Rebase and follow-through on work done by @cmr and @aatch. Implements most of rust-lang/rfcs#560. Errors encountered from the checks during building were fixed. The checks for division, remainder and bit-shifting have not been implemented yet. See also PR #20795 cc @Aatch ; cc @nikomatsakis
Diffstat (limited to 'src/libcoretest')
| -rw-r--r-- | src/libcoretest/num/mod.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/libcoretest/num/mod.rs b/src/libcoretest/num/mod.rs index 1cd1989c11d..721354b6a44 100644 --- a/src/libcoretest/num/mod.rs +++ b/src/libcoretest/num/mod.rs @@ -92,7 +92,7 @@ mod test { assert_eq!("127".parse::<i8>().ok(), Some(i8_val)); assert_eq!("128".parse::<i8>().ok(), None); - i8_val += 1 as i8; + i8_val = i8_val.wrapping_add(1); assert_eq!("-128".parse::<i8>().ok(), Some(i8_val)); assert_eq!("-129".parse::<i8>().ok(), None); @@ -100,7 +100,7 @@ mod test { assert_eq!("32767".parse::<i16>().ok(), Some(i16_val)); assert_eq!("32768".parse::<i16>().ok(), None); - i16_val += 1 as i16; + i16_val = i16_val.wrapping_add(1); assert_eq!("-32768".parse::<i16>().ok(), Some(i16_val)); assert_eq!("-32769".parse::<i16>().ok(), None); @@ -108,7 +108,7 @@ mod test { assert_eq!("2147483647".parse::<i32>().ok(), Some(i32_val)); assert_eq!("2147483648".parse::<i32>().ok(), None); - i32_val += 1 as i32; + i32_val = i32_val.wrapping_add(1); assert_eq!("-2147483648".parse::<i32>().ok(), Some(i32_val)); assert_eq!("-2147483649".parse::<i32>().ok(), None); @@ -116,7 +116,7 @@ mod test { assert_eq!("9223372036854775807".parse::<i64>().ok(), Some(i64_val)); assert_eq!("9223372036854775808".parse::<i64>().ok(), None); - i64_val += 1 as i64; + i64_val = i64_val.wrapping_add(1); assert_eq!("-9223372036854775808".parse::<i64>().ok(), Some(i64_val)); assert_eq!("-9223372036854775809".parse::<i64>().ok(), None); } |
