2024-02-16 20:02:50 +00:00
|
|
|
//@ run-pass
|
|
|
|
//@ needs-unwind
|
|
|
|
//@ compile-flags: -C debug_assertions=yes
|
2016-09-12 15:23:02 +00:00
|
|
|
|
|
|
|
use std::panic;
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let r = panic::catch_unwind(|| {
|
2020-06-02 07:59:11 +00:00
|
|
|
let mut it = u8::MAX..;
|
2016-11-02 14:11:53 +00:00
|
|
|
it.next().unwrap(); // 255
|
2016-10-22 20:27:31 +00:00
|
|
|
it.next().unwrap();
|
2016-09-12 15:23:02 +00:00
|
|
|
});
|
|
|
|
assert!(r.is_err());
|
|
|
|
|
|
|
|
let r = panic::catch_unwind(|| {
|
2020-06-02 07:59:11 +00:00
|
|
|
let mut it = i8::MAX..;
|
2016-11-02 14:11:53 +00:00
|
|
|
it.next().unwrap(); // 127
|
2016-10-22 20:27:31 +00:00
|
|
|
it.next().unwrap();
|
2016-09-12 15:23:02 +00:00
|
|
|
});
|
|
|
|
assert!(r.is_err());
|
|
|
|
}
|