about summary refs log tree commit diff
path: root/src/libcore
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2016-11-07 11:48:16 -0800
committerGitHub <noreply@github.com>2016-11-07 11:48:16 -0800
commit57f971bc1610ef57c57616822c60aadc7e477904 (patch)
tree09c397f61199a454ea46c49c95690aa2d81de394 /src/libcore
parentec0d1ceb4288cd5e36187f1b523bd1a522537ad4 (diff)
parent8f19d5c3f6e9e6b37a63175875eae6c11c56822e (diff)
Auto merge of #36365 - matthew-piziak:silent-overflow, r=eddyb
fix silent overflows on `Step` impls

Part of https://github.com/rust-lang/rust/issues/36110

r? @eddyb
Diffstat (limited to 'src/libcore')
-rw-r--r--src/libcore/iter/range.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/libcore/iter/range.rs b/src/libcore/iter/range.rs
index 7c96be2facb..e6f21d6c17a 100644
--- a/src/libcore/iter/range.rs
+++ b/src/libcore/iter/range.rs
@@ -96,12 +96,12 @@ macro_rules! step_impl_unsigned {
 
             #[inline]
             fn add_one(&self) -> Self {
-                *self + 1
+                Add::add(*self, 1)
             }
 
             #[inline]
             fn sub_one(&self) -> Self {
-                *self - 1
+                Sub::sub(*self, 1)
             }
 
             #[inline]
@@ -167,12 +167,12 @@ macro_rules! step_impl_signed {
 
             #[inline]
             fn add_one(&self) -> Self {
-                *self + 1
+                Add::add(*self, 1)
             }
 
             #[inline]
             fn sub_one(&self) -> Self {
-                *self - 1
+                Sub::sub(*self, 1)
             }
 
             #[inline]
@@ -216,12 +216,12 @@ macro_rules! step_impl_no_between {
 
             #[inline]
             fn add_one(&self) -> Self {
-                *self + 1
+                Add::add(*self, 1)
             }
 
             #[inline]
             fn sub_one(&self) -> Self {
-                *self - 1
+                Sub::sub(*self, 1)
             }
 
             #[inline]