mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-27 18:57:42 +03:00
620e92f016
stabilizes `core::range::Range` stabilizes `core::range::RangeIter` stabilizes `std::range` which was missed in prior PRs Updates docs to reflect stabilization (removed "experimental") `RangeIter::remainder` is excluded from stabilization
68 lines
1.0 KiB
Rust
68 lines
1.0 KiB
Rust
// Stable
|
|
|
|
use std::range::{
|
|
RangeInclusive,
|
|
RangeInclusiveIter,
|
|
RangeToInclusive,
|
|
RangeFrom,
|
|
RangeFromIter,
|
|
Range,
|
|
};
|
|
|
|
fn range_inclusive(mut r: RangeInclusive<usize>) {
|
|
&[1, 2, 3][r]; // Indexing
|
|
|
|
r.start;
|
|
r.last;
|
|
r.contains(&5);
|
|
r.is_empty();
|
|
r.iter();
|
|
|
|
let mut i = r.into_iter();
|
|
i.next();
|
|
i.remainder(); //~ ERROR unstable
|
|
}
|
|
|
|
fn range_to_inclusive(mut r: RangeToInclusive<usize>) {
|
|
&[1, 2, 3][r]; // Indexing
|
|
|
|
r.last;
|
|
r.contains(&5);
|
|
}
|
|
|
|
fn range_from(mut r: RangeFrom<usize>) {
|
|
&[1, 2, 3][r]; // Indexing
|
|
|
|
r.start;
|
|
r.contains(&5);
|
|
r.iter();
|
|
|
|
let mut i = r.into_iter();
|
|
i.next();
|
|
|
|
// Left unstable
|
|
i.remainder(); //~ ERROR unstable
|
|
}
|
|
|
|
fn range(mut r: Range<usize>) {
|
|
&[1, 2, 3][r];
|
|
|
|
r.start;
|
|
r.end;
|
|
r.contains(&5);
|
|
r.is_empty();
|
|
r.iter();
|
|
|
|
let mut i = r.into_iter();
|
|
i.next();
|
|
|
|
// Left unstable
|
|
i.remainder(); //~ ERROR unstable
|
|
}
|
|
|
|
// Unstable module
|
|
|
|
use std::range::legacy; //~ ERROR unstable
|
|
|
|
fn main() {}
|