Skip to content

Commit 8f19d5c

Browse files
add max value from iterator
1 parent dd6e8c5 commit 8f19d5c

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

Diff for: src/test/run-pass/iter-step-overflow-debug.rs

+2
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,14 @@ use std::panic;
1515
fn main() {
1616
let r = panic::catch_unwind(|| {
1717
let mut it = u8::max_value()..;
18+
it.next().unwrap(); // 255
1819
it.next().unwrap();
1920
});
2021
assert!(r.is_err());
2122

2223
let r = panic::catch_unwind(|| {
2324
let mut it = i8::max_value()..;
25+
it.next().unwrap(); // 127
2426
it.next().unwrap();
2527
});
2628
assert!(r.is_err());

Diff for: src/test/run-pass/iter-step-overflow-ndebug.rs

+2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,10 @@
1212

1313
fn main() {
1414
let mut it = u8::max_value()..;
15+
assert_eq!(it.next().unwrap(), 255);
1516
assert_eq!(it.next().unwrap(), u8::min_value());
1617

1718
let mut it = i8::max_value()..;
19+
assert_eq!(it.next().unwrap(), 127);
1820
assert_eq!(it.next().unwrap(), i8::min_value());
1921
}

0 commit comments

Comments
 (0)