mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-27 18:57:42 +03:00
Clarify that core::range::RangeInclusive does 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.
This commit is contained in:
@@ -223,21 +223,24 @@ fn from(value: legacy::Range<T>) -> Self {
|
||||
}
|
||||
}
|
||||
|
||||
/// A range bounded inclusively below and above (`start..=last`).
|
||||
/// A range bounded inclusively below and above.
|
||||
///
|
||||
/// The `RangeInclusive` `start..=last` contains all values with `x >= start`
|
||||
/// The `RangeInclusive` contains all values with `x >= start`
|
||||
/// and `x <= last`. It is empty unless `start <= last`.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// The `start..=last` syntax is a `RangeInclusive`:
|
||||
///
|
||||
/// ```
|
||||
/// use core::range::RangeInclusive;
|
||||
///
|
||||
/// assert_eq!(RangeInclusive::from(3..=5), RangeInclusive { start: 3, last: 5 });
|
||||
/// assert_eq!(3 + 4 + 5, RangeInclusive::from(3..=5).into_iter().sum());
|
||||
/// ```
|
||||
///
|
||||
/// # Edition notes
|
||||
///
|
||||
/// It is planned that the syntax `start..=last` will construct this
|
||||
/// type in a future edition, but it does not do so today.
|
||||
#[lang = "RangeInclusiveCopy"]
|
||||
#[derive(Clone, Copy, PartialEq, Eq, Hash)]
|
||||
#[stable(feature = "new_range_inclusive_api", since = "1.95.0")]
|
||||
|
||||
Reference in New Issue
Block a user