2018-08-30 07:18:55 -05:00
|
|
|
// run-pass
|
2019-10-18 16:47:54 -05:00
|
|
|
// ignore-wasm32-bare compiled with panic=abort by default
|
2016-09-12 10:23:02 -05:00
|
|
|
// compile-flags: -C debug_assertions=yes
|
|
|
|
|
|
|
|
use std::panic;
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let r = panic::catch_unwind(|| {
|
2016-10-11 14:58:27 -05:00
|
|
|
let mut it = u8::max_value()..;
|
2016-11-02 09:11:53 -05:00
|
|
|
it.next().unwrap(); // 255
|
2016-10-22 15:27:31 -05:00
|
|
|
it.next().unwrap();
|
2016-09-12 10:23:02 -05:00
|
|
|
});
|
|
|
|
assert!(r.is_err());
|
|
|
|
|
|
|
|
let r = panic::catch_unwind(|| {
|
2016-10-11 14:58:27 -05:00
|
|
|
let mut it = i8::max_value()..;
|
2016-11-02 09:11:53 -05:00
|
|
|
it.next().unwrap(); // 127
|
2016-10-22 15:27:31 -05:00
|
|
|
it.next().unwrap();
|
2016-09-12 10:23:02 -05:00
|
|
|
});
|
|
|
|
assert!(r.is_err());
|
|
|
|
}
|