mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-30 23:03:06 +03:00
f68f5980c3
Split the remainder functions from the rest of `std::range`.
(cherry picked from commit 0bb3fe315e)
19 lines
383 B
Rust
19 lines
383 B
Rust
//@ run-pass
|
|
//@ needs-unwind
|
|
//@ compile-flags: -O -C debug_assertions=yes
|
|
|
|
#![feature(new_range_api)]
|
|
#![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());
|
|
}
|