mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-30 14:52:56 +03:00
0bb3fe315e
Split the remainder functions from the rest of `std::range`.
18 lines
356 B
Rust
18 lines
356 B
Rust
//@ run-pass
|
|
//@ needs-unwind
|
|
//@ compile-flags: -O -C debug_assertions=yes
|
|
|
|
#![feature(new_range_remainder)]
|
|
|
|
use std::panic;
|
|
|
|
fn main() {
|
|
let mut it = core::range::RangeFrom::from(u8::MAX..).into_iter();
|
|
assert_eq!(it.next().unwrap(), 255);
|
|
|
|
let r = panic::catch_unwind(|| {
|
|
let _ = it.remainder();
|
|
});
|
|
assert!(r.is_err());
|
|
}
|