about summary refs log tree commit diff
path: root/example
diff options
context:
space:
mode:
authorbjorn3 <bjorn3@users.noreply.github.com>2021-04-16 14:36:07 +0200
committerbjorn3 <bjorn3@users.noreply.github.com>2021-04-16 14:36:07 +0200
commit7f0e35106e3cce054551de8305f8bcbc25ef59f8 (patch)
tree5678930a67bcbb3a8c99840890389b4f141c80c5 /example
parent6d6c5742896fab93788b4dabb6ba2fcf1881f5e2 (diff)
downloadrust-7f0e35106e3cce054551de8305f8bcbc25ef59f8.tar.gz
rust-7f0e35106e3cce054551de8305f8bcbc25ef59f8.zip
Fix overflow checking when multiplying two i64
Fixes #1162
Diffstat (limited to 'example')
-rw-r--r--example/std_example.rs2
1 files changed, 2 insertions, 0 deletions
diff --git a/example/std_example.rs b/example/std_example.rs
index 437b7726980..77ba72df8ef 100644
--- a/example/std_example.rs
+++ b/example/std_example.rs
@@ -48,6 +48,8 @@ fn main() {
     assert_eq!(2.3f32.copysign(-1.0), -2.3f32);
     println!("{}", 2.3f32.powf(2.0));
 
+    assert_eq!(i64::MAX.checked_mul(2), None);
+
     assert_eq!(-128i8, (-128i8).saturating_sub(1));
     assert_eq!(127i8, 127i8.saturating_sub(-128));
     assert_eq!(-128i8, (-128i8).saturating_add(-128));