From 092f0ca1bd6ce2e96796ab82c3325750a2254e38 Mon Sep 17 00:00:00 2001 From: Jake Goulding Date: Wed, 8 Apr 2026 14:00:50 -0400 Subject: [PATCH] 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. --- library/core/src/range.rs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/library/core/src/range.rs b/library/core/src/range.rs index d4be1b67d386..bdfb59b31834 100644 --- a/library/core/src/range.rs +++ b/library/core/src/range.rs @@ -223,21 +223,24 @@ fn from(value: legacy::Range) -> 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")]