summary refs log tree commit diff
path: root/src/libcoretest
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/libcoretest
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/libcoretest')
-rw-r--r--src/libcoretest/num/uint_macros.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/libcoretest/num/uint_macros.rs b/src/libcoretest/num/uint_macros.rs
index 39e41a4fad3..e3eff6e7512 100644
--- a/src/libcoretest/num/uint_macros.rs
+++ b/src/libcoretest/num/uint_macros.rs
@@ -20,7 +20,7 @@ mod tests {
     fn test_overflows() {
         assert!(MAX > 0);
         assert!(MIN <= 0);
-        assert!(MIN + MAX + 1 == 0);
+        assert!((MIN + MAX).wrapping_add(1) == 0);
     }
 
     #[test]