Skip to content

Commit 6ae5693

Browse files
shepmastercuviper
authored andcommitted
Clarify that core::range::{Range,RangeFrom,RangeToInclusive} do not have special syntax
I'm ignoring the fact that there's a feature to change the behavior of the syntax. I just want to help prevent confusing the people reading the docs. (cherry picked from commit eef4363)
1 parent 2b3d5e6 commit 6ae5693

File tree

1 file changed

+21
-11
lines changed

1 file changed

+21
-11
lines changed

‎library/core/src/range.rs‎

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,9 @@ use crate::iter::Step;
4545
use crate::ops::Bound::{self, Excluded, Included, Unbounded};
4646
use crate::ops::{IntoBounds, RangeBounds};
4747

48-
/// A (half-open) range bounded inclusively below and exclusively above
49-
/// (`start..end` in a future edition).
48+
/// A (half-open) range bounded inclusively below and exclusively above.
5049
///
51-
/// The range `start..end` contains all values with `start <= x < end`.
50+
/// The `Range` contains all values with `start <= x < end`.
5251
/// It is empty if `start >= end`.
5352
///
5453
/// # Examples
@@ -60,6 +59,11 @@ use crate::ops::{IntoBounds, RangeBounds};
6059
/// assert_eq!(Range::from(3..5), Range { start: 3, end: 5 });
6160
/// assert_eq!(3 + 4 + 5, Range::from(3..6).into_iter().sum());
6261
/// ```
62+
///
63+
/// # Edition notes
64+
///
65+
/// It is planned that the syntax `start..end` will construct this
66+
/// type in a future edition, but it does not do so today.
6367
#[lang = "RangeCopy"]
6468
#[derive(Copy, Hash)]
6569
#[derive_const(Clone, Default, PartialEq, Eq)]
@@ -415,9 +419,9 @@ impl<T> const From<legacy::RangeInclusive<T>> for RangeInclusive<T> {
415419
}
416420
}
417421

418-
/// A range only bounded inclusively below (`start..`).
422+
/// A range only bounded inclusively below.
419423
///
420-
/// The `RangeFrom` `start..` contains all values with `x >= start`.
424+
/// The `RangeFrom` contains all values with `x >= start`.
421425
///
422426
/// *Note*: Overflow in the [`Iterator`] implementation (when the contained
423427
/// data type reaches its numerical limit) is allowed to panic, wrap, or
@@ -432,15 +436,18 @@ impl<T> const From<legacy::RangeInclusive<T>> for RangeInclusive<T> {
432436
///
433437
/// # Examples
434438
///
435-
/// The `start..` syntax is a `RangeFrom`:
436-
///
437439
/// ```
438440
/// #![feature(new_range_api)]
439441
/// use core::range::RangeFrom;
440442
///
441443
/// assert_eq!(RangeFrom::from(2..), core::range::RangeFrom { start: 2 });
442444
/// assert_eq!(2 + 3 + 4, RangeFrom::from(2..).into_iter().take(3).sum());
443445
/// ```
446+
///
447+
/// # Edition notes
448+
///
449+
/// It is planned that the syntax `start..` will construct this
450+
/// type in a future edition, but it does not do so today.
444451
#[lang = "RangeFromCopy"]
445452
#[derive(Copy, Hash)]
446453
#[derive_const(Clone, PartialEq, Eq)]
@@ -566,15 +573,13 @@ impl<T> const From<legacy::RangeFrom<T>> for RangeFrom<T> {
566573
}
567574
}
568575

569-
/// A range only bounded inclusively above (`..=last`).
576+
/// A range only bounded inclusively above.
570577
///
571-
/// The `RangeToInclusive` `..=last` contains all values with `x <= last`.
578+
/// The `RangeToInclusive` contains all values with `x <= last`.
572579
/// It cannot serve as an [`Iterator`] because it doesn't have a starting point.
573580
///
574581
/// # Examples
575582
///
576-
/// The `..=last` syntax is a `RangeToInclusive`:
577-
///
578583
/// ```
579584
/// #![feature(new_range_api)]
580585
/// #![feature(new_range)]
@@ -606,6 +611,11 @@ impl<T> const From<legacy::RangeFrom<T>> for RangeFrom<T> {
606611
/// ```
607612
///
608613
/// [slicing index]: crate::slice::SliceIndex
614+
///
615+
/// # Edition notes
616+
///
617+
/// It is planned that the syntax `..=last` will construct this
618+
/// type in a future edition, but it does not do so today.
609619
#[lang = "RangeToInclusiveCopy"]
610620
#[doc(alias = "..=")]
611621
#[derive(Copy, Clone, PartialEq, Eq, Hash)]

0 commit comments

Comments
 (0)