mirror of
https://github.com/allankoechke/rust.git
synced 2026-12-03 01:25:15 +00:00
Stabilized under `new_range_api_exports`. Newly stable API:
core::range::RangeFull;
core::range::RangeTo;
25 lines
760 B
Rust
25 lines
760 B
Rust
//! With the `new_range` feature enabled, `..` syntax resolves to the new range types.
|
|
//@ check-pass
|
|
|
|
#![feature(new_range)]
|
|
|
|
fn main() {
|
|
// Unchanged
|
|
let a: core::ops::RangeFull = ..;
|
|
let b: core::ops::RangeTo<u8> = ..2;
|
|
|
|
let _: core::range::RangeFull = a;
|
|
let _: core::range::RangeTo<u8> = b;
|
|
|
|
// Changed
|
|
let a: core::range::RangeFrom<u8> = 1..;
|
|
let b: core::range::Range<u8> = 2..3;
|
|
let c: core::range::RangeInclusive<u8> = 4..=5;
|
|
let d: core::range::RangeToInclusive<u8> = ..=3;
|
|
|
|
let _: core::range::RangeFromIter<u8> = a.into_iter();
|
|
let _: core::range::RangeIter<u8> = b.into_iter();
|
|
let _: core::range::RangeInclusiveIter<u8> = c.into_iter();
|
|
// RangeToInclusive has no Iterator implementation
|
|
}
|