Skip to content

Commit eef4363

Browse files
committed
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.
1 parent 092f0ca commit eef4363

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
@@ -47,10 +47,9 @@ use crate::iter::Step;
4747
use crate::ops::Bound::{self, Excluded, Included, Unbounded};
4848
use crate::ops::{IntoBounds, OneSidedRange, OneSidedRangeBound, RangeBounds};
4949

50-
/// A (half-open) range bounded inclusively below and exclusively above
51-
/// (`start..end` in a future edition).
50+
/// A (half-open) range bounded inclusively below and exclusively above.
5251
///
53-
/// The range `start..end` contains all values with `start <= x < end`.
52+
/// The `Range` contains all values with `start <= x < end`.
5453
/// It is empty if `start >= end`.
5554
///
5655
/// # Examples
@@ -61,6 +60,11 @@ use crate::ops::{IntoBounds, OneSidedRange, OneSidedRangeBound, RangeBounds};
6160
/// assert_eq!(Range::from(3..5), Range { start: 3, end: 5 });
6261
/// assert_eq!(3 + 4 + 5, Range::from(3..6).into_iter().sum());
6362
/// ```
63+
///
64+
/// # Edition notes
65+
///
66+
/// It is planned that the syntax `start..end` will construct this
67+
/// type in a future edition, but it does not do so today.
6468
#[lang = "RangeCopy"]
6569
#[derive(Copy, Hash)]
6670
#[derive_const(Clone, Default, PartialEq, Eq)]
@@ -410,9 +414,9 @@ impl<T> const From<legacy::RangeInclusive<T>> for RangeInclusive<T> {
410414
}
411415
}
412416

413-
/// A range only bounded inclusively below (`start..`).
417+
/// A range only bounded inclusively below.
414418
///
415-
/// The `RangeFrom` `start..` contains all values with `x >= start`.
419+
/// The `RangeFrom` contains all values with `x >= start`.
416420
///
417421
/// *Note*: Overflow in the [`IntoIterator`] implementation (when the contained
418422
/// data type reaches its numerical limit) is allowed to panic, wrap, or
@@ -426,14 +430,17 @@ impl<T> const From<legacy::RangeInclusive<T>> for RangeInclusive<T> {
426430
///
427431
/// # Examples
428432
///
429-
/// The `start..` syntax is a `RangeFrom`:
430-
///
431433
/// ```
432434
/// use core::range::RangeFrom;
433435
///
434436
/// assert_eq!(RangeFrom::from(2..), core::range::RangeFrom { start: 2 });
435437
/// assert_eq!(2 + 3 + 4, RangeFrom::from(2..).into_iter().take(3).sum());
436438
/// ```
439+
///
440+
/// # Edition notes
441+
///
442+
/// It is planned that the syntax `start..` will construct this
443+
/// type in a future edition, but it does not do so today.
437444
#[lang = "RangeFromCopy"]
438445
#[derive(Copy, Hash)]
439446
#[derive_const(Clone, PartialEq, Eq)]
@@ -567,15 +574,13 @@ impl<T> const From<legacy::RangeFrom<T>> for RangeFrom<T> {
567574
}
568575
}
569576

570-
/// A range only bounded inclusively above (`..=last`).
577+
/// A range only bounded inclusively above.
571578
///
572-
/// The `RangeToInclusive` `..=last` contains all values with `x <= last`.
579+
/// The `RangeToInclusive` contains all values with `x <= last`.
573580
/// It cannot serve as an [`Iterator`] because it doesn't have a starting point.
574581
///
575582
/// # Examples
576583
///
577-
/// The `..=last` syntax is a `RangeToInclusive`:
578-
///
579584
/// ```standalone_crate
580585
/// #![feature(new_range)]
581586
/// assert_eq!((..=5), std::range::RangeToInclusive { last: 5 });
@@ -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)