summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2015-03-31 18:06:35 -0700
committerAlex Crichton <alex@alexcrichton.com>2015-03-31 18:06:35 -0700
commit4f643d79fc9573489c178eb283a7da1a1e8402c1 (patch)
tree76b2c1726ef8165e0ef5c1cd5d769c4a11de79ee /src/libstd
parent72f59732d7974767650abfc58f8287212e5a1fba (diff)
parent2a9de1d989d7f95846b711eec2695cbd86794ee3 (diff)
downloadrust-4f643d79fc9573489c178eb283a7da1a1e8402c1.tar.gz
rust-4f643d79fc9573489c178eb283a7da1a1e8402c1.zip
rollup merge of #23863: pnkfelix/arith-oflo-const-eval
const_eval : add overflow-checking for {`+`, `-`, `*`, `/`, `<<`, `>>`}.

One tricky detail here: There is some duplication of labor between `rustc::middle::const_eval` and `rustc_trans::trans::consts`. It might be good to explore ways to try to factor out the common structure to the two passes (by abstracting over the particular value-representation used in the compile-time interpreter).

----

Update: Rebased atop #23841

Fix #22531

Fix #23030

Fix #23221

Fix #23235
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/old_io/extensions.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/libstd/old_io/extensions.rs b/src/libstd/old_io/extensions.rs
index 0e5dd3aa4aa..aec794af759 100644
--- a/src/libstd/old_io/extensions.rs
+++ b/src/libstd/old_io/extensions.rs
@@ -519,7 +519,8 @@ mod bench {
         ({
             use super::u64_from_be_bytes;
 
-            let data = (0..$stride*100+$start_index).collect::<Vec<_>>();
+            let len = $stride.wrapping_mul(100).wrapping_add($start_index);
+            let data = (0..len).collect::<Vec<_>>();
             let mut sum = 0;
             $b.iter(|| {
                 let mut i = $start_index;