Skip to content

Commit 92d1f8d

Browse files
committed
Stabilize inclusive_range_syntax language feature.
Stabilize the syntax `a..=b` and `..=b`.
1 parent b5913f2 commit 92d1f8d

File tree

19 files changed

+19
-138
lines changed

19 files changed

+19
-138
lines changed

src/doc/unstable-book/src/language-features/inclusive-range-syntax.md

Lines changed: 0 additions & 20 deletions
This file was deleted.

src/liballoc/tests/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
#![feature(alloc_system)]
1515
#![feature(attr_literals)]
1616
#![feature(box_syntax)]
17-
#![feature(inclusive_range_syntax)]
17+
#![cfg_attr(stage0, feature(inclusive_range_syntax))]
1818
#![feature(collection_placement)]
1919
#![feature(const_fn)]
2020
#![feature(drain_filter)]

src/libcore/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@
7979
#![feature(fn_must_use)]
8080
#![feature(fundamental)]
8181
#![feature(i128_type)]
82-
#![feature(inclusive_range_syntax)]
82+
#![cfg_attr(stage0, feature(inclusive_range_syntax))]
8383
#![feature(intrinsics)]
8484
#![feature(iterator_flatten)]
8585
#![feature(iterator_repeat_with)]

src/libcore/ops/range.rs

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ impl<Idx: PartialOrd<Idx>> Range<Idx> {
128128
/// The range is empty if either side is incomparable:
129129
///
130130
/// ```
131-
/// #![feature(range_is_empty,inclusive_range_syntax)]
131+
/// #![feature(range_is_empty)]
132132
///
133133
/// use std::f32::NAN;
134134
/// assert!(!(3.0..5.0).is_empty());
@@ -283,8 +283,6 @@ impl<Idx: PartialOrd<Idx>> RangeTo<Idx> {
283283
/// # Examples
284284
///
285285
/// ```
286-
/// #![feature(inclusive_range_syntax)]
287-
///
288286
/// assert_eq!((3..=5), std::ops::RangeInclusive { start: 3, end: 5 });
289287
/// assert_eq!(3 + 4 + 5, (3..=5).sum());
290288
///
@@ -316,7 +314,7 @@ impl<Idx: PartialOrd<Idx>> RangeInclusive<Idx> {
316314
/// # Examples
317315
///
318316
/// ```
319-
/// #![feature(range_contains,inclusive_range_syntax)]
317+
/// #![feature(range_contains)]
320318
///
321319
/// assert!(!(3..=5).contains(2));
322320
/// assert!( (3..=5).contains(3));
@@ -337,7 +335,7 @@ impl<Idx: PartialOrd<Idx>> RangeInclusive<Idx> {
337335
/// # Examples
338336
///
339337
/// ```
340-
/// #![feature(range_is_empty,inclusive_range_syntax)]
338+
/// #![feature(range_is_empty)]
341339
///
342340
/// assert!(!(3..=5).is_empty());
343341
/// assert!(!(3..=3).is_empty());
@@ -347,7 +345,7 @@ impl<Idx: PartialOrd<Idx>> RangeInclusive<Idx> {
347345
/// The range is empty if either side is incomparable:
348346
///
349347
/// ```
350-
/// #![feature(range_is_empty,inclusive_range_syntax)]
348+
/// #![feature(range_is_empty)]
351349
///
352350
/// use std::f32::NAN;
353351
/// assert!(!(3.0..=5.0).is_empty());
@@ -358,7 +356,7 @@ impl<Idx: PartialOrd<Idx>> RangeInclusive<Idx> {
358356
/// This method returns `true` after iteration has finished:
359357
///
360358
/// ```
361-
/// #![feature(range_is_empty,inclusive_range_syntax)]
359+
/// #![feature(range_is_empty)]
362360
///
363361
/// let mut r = 3..=5;
364362
/// for _ in r.by_ref() {}
@@ -381,16 +379,13 @@ impl<Idx: PartialOrd<Idx>> RangeInclusive<Idx> {
381379
/// The `..=end` syntax is a `RangeToInclusive`:
382380
///
383381
/// ```
384-
/// #![feature(inclusive_range_syntax)]
385382
/// assert_eq!((..=5), std::ops::RangeToInclusive{ end: 5 });
386383
/// ```
387384
///
388385
/// It does not have an [`IntoIterator`] implementation, so you can't use it in a
389386
/// `for` loop directly. This won't compile:
390387
///
391388
/// ```compile_fail,E0277
392-
/// #![feature(inclusive_range_syntax)]
393-
///
394389
/// // error[E0277]: the trait bound `std::ops::RangeToInclusive<{integer}>:
395390
/// // std::iter::Iterator` is not satisfied
396391
/// for i in ..=5 {
@@ -402,8 +397,6 @@ impl<Idx: PartialOrd<Idx>> RangeInclusive<Idx> {
402397
/// array elements up to and including the index indicated by `end`.
403398
///
404399
/// ```
405-
/// #![feature(inclusive_range_syntax)]
406-
///
407400
/// let arr = [0, 1, 2, 3];
408401
/// assert_eq!(arr[ ..=2], [0,1,2 ]); // RangeToInclusive
409402
/// assert_eq!(arr[1..=2], [ 1,2 ]);
@@ -434,7 +427,7 @@ impl<Idx: PartialOrd<Idx>> RangeToInclusive<Idx> {
434427
/// # Examples
435428
///
436429
/// ```
437-
/// #![feature(range_contains,inclusive_range_syntax)]
430+
/// #![feature(range_contains)]
438431
///
439432
/// assert!( (..=5).contains(-1_000_000_000));
440433
/// assert!( (..=5).contains(5));

src/libcore/tests/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
#![feature(fmt_internals)]
2424
#![feature(iterator_step_by)]
2525
#![feature(i128_type)]
26-
#![feature(inclusive_range_syntax)]
26+
#![cfg_attr(stage0, feature(inclusive_range_syntax))]
2727
#![feature(iterator_try_fold)]
2828
#![feature(iterator_flatten)]
2929
#![feature(conservative_impl_trait)]

src/librustc/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
#![feature(fs_read_write)]
5555
#![feature(i128)]
5656
#![feature(i128_type)]
57-
#![feature(inclusive_range_syntax)]
57+
#![cfg_attr(stage0, feature(inclusive_range_syntax))]
5858
#![cfg_attr(windows, feature(libc))]
5959
#![feature(match_default_bindings)]
6060
#![feature(macro_lifetime_matcher)]

src/librustc_incremental/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#![feature(conservative_impl_trait)]
1919
#![feature(fs_read_write)]
2020
#![feature(i128_type)]
21-
#![feature(inclusive_range_syntax)]
21+
#![cfg_attr(stage0, feature(inclusive_range_syntax))]
2222
#![feature(specialization)]
2323

2424
extern crate graphviz;

src/librustc_mir/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Rust MIR: a lowered representation of Rust. Also: an experiment!
2828
#![feature(dyn_trait)]
2929
#![feature(fs_read_write)]
3030
#![feature(i128_type)]
31-
#![feature(inclusive_range_syntax)]
31+
#![cfg_attr(stage0, feature(inclusive_range_syntax))]
3232
#![feature(macro_vis_matcher)]
3333
#![feature(match_default_bindings)]
3434
#![feature(exhaustive_patterns)]

src/librustc_trans/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
#![allow(unused_attributes)]
2727
#![feature(i128_type)]
2828
#![feature(i128)]
29-
#![feature(inclusive_range_syntax)]
29+
#![cfg_attr(stage0, feature(inclusive_range_syntax))]
3030
#![feature(libc)]
3131
#![feature(quote)]
3232
#![feature(rustc_diagnostic_macros)]

src/libsyntax/diagnostic_list.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -218,8 +218,6 @@ An inclusive range was used with no end.
218218
Erroneous code example:
219219
220220
```compile_fail,E0586
221-
#![feature(inclusive_range_syntax)]
222-
223221
fn main() {
224222
let tmp = vec![0, 1, 2, 3, 4, 4, 3, 3, 2, 1];
225223
let x = &tmp[1..=]; // error: inclusive range was used with no end
@@ -239,8 +237,6 @@ fn main() {
239237
Or put an end to your inclusive range:
240238
241239
```
242-
#![feature(inclusive_range_syntax)]
243-
244240
fn main() {
245241
let tmp = vec![0, 1, 2, 3, 4, 4, 3, 3, 2, 1];
246242
let x = &tmp[1..=3]; // ok!

0 commit comments

Comments
 (0)