File tree 3 files changed +56
-6
lines changed
3 files changed +56
-6
lines changed Original file line number Diff line number Diff line change @@ -96,12 +96,12 @@ macro_rules! step_impl_unsigned {
96
96
97
97
#[ inline]
98
98
fn add_one( & self ) -> Self {
99
- * self + 1
99
+ Add :: add ( * self , 1 )
100
100
}
101
101
102
102
#[ inline]
103
103
fn sub_one( & self ) -> Self {
104
- * self - 1
104
+ Sub :: sub ( * self , 1 )
105
105
}
106
106
107
107
#[ inline]
@@ -167,12 +167,12 @@ macro_rules! step_impl_signed {
167
167
168
168
#[ inline]
169
169
fn add_one( & self ) -> Self {
170
- * self + 1
170
+ Add :: add ( * self , 1 )
171
171
}
172
172
173
173
#[ inline]
174
174
fn sub_one( & self ) -> Self {
175
- * self - 1
175
+ Sub :: sub ( * self , 1 )
176
176
}
177
177
178
178
#[ inline]
@@ -216,12 +216,12 @@ macro_rules! step_impl_no_between {
216
216
217
217
#[ inline]
218
218
fn add_one( & self ) -> Self {
219
- * self + 1
219
+ Add :: add ( * self , 1 )
220
220
}
221
221
222
222
#[ inline]
223
223
fn sub_one( & self ) -> Self {
224
- * self - 1
224
+ Sub :: sub ( * self , 1 )
225
225
}
226
226
227
227
#[ inline]
Original file line number Diff line number Diff line change
1
+ // Copyright 2016 The Rust Project Developers. See the COPYRIGHT
2
+ // file at the top-level directory of this distribution and at
3
+ // http://rust-lang.org/COPYRIGHT.
4
+ //
5
+ // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6
+ // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7
+ // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8
+ // option. This file may not be copied, modified, or distributed
9
+ // except according to those terms.
10
+
11
+ // compile-flags: -C debug_assertions=yes
12
+
13
+ use std:: panic;
14
+
15
+ fn main ( ) {
16
+ let r = panic:: catch_unwind ( || {
17
+ let mut it = u8:: max_value ( ) ..;
18
+ it. next ( ) . unwrap ( ) ; // 255
19
+ it. next ( ) . unwrap ( ) ;
20
+ } ) ;
21
+ assert ! ( r. is_err( ) ) ;
22
+
23
+ let r = panic:: catch_unwind ( || {
24
+ let mut it = i8:: max_value ( ) ..;
25
+ it. next ( ) . unwrap ( ) ; // 127
26
+ it. next ( ) . unwrap ( ) ;
27
+ } ) ;
28
+ assert ! ( r. is_err( ) ) ;
29
+ }
Original file line number Diff line number Diff line change
1
+ // Copyright 2016 The Rust Project Developers. See the COPYRIGHT
2
+ // file at the top-level directory of this distribution and at
3
+ // http://rust-lang.org/COPYRIGHT.
4
+ //
5
+ // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6
+ // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7
+ // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8
+ // option. This file may not be copied, modified, or distributed
9
+ // except according to those terms.
10
+
11
+ // compile-flags: -C debug_assertions=no
12
+
13
+ fn main ( ) {
14
+ let mut it = u8:: max_value ( ) ..;
15
+ assert_eq ! ( it. next( ) . unwrap( ) , 255 ) ;
16
+ assert_eq ! ( it. next( ) . unwrap( ) , u8 :: min_value( ) ) ;
17
+
18
+ let mut it = i8:: max_value ( ) ..;
19
+ assert_eq ! ( it. next( ) . unwrap( ) , 127 ) ;
20
+ assert_eq ! ( it. next( ) . unwrap( ) , i8 :: min_value( ) ) ;
21
+ }
You can’t perform that action at this time.
0 commit comments