File tree 1 file changed +17
-1
lines changed
1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -362,12 +362,20 @@ impl<Idx> RangeInclusive<Idx> {
362
362
/// ```
363
363
#[ unstable( feature = "inclusive_range_methods" , issue = "49022" ) ]
364
364
#[ inline]
365
- pub fn new ( start : Idx , end : Idx ) -> Self {
365
+ pub const fn new ( start : Idx , end : Idx ) -> Self {
366
366
Self { start, end }
367
367
}
368
368
369
369
/// Returns the lower bound of the range (inclusive).
370
370
///
371
+ /// When using an inclusive range for iteration, the values of `start()` and
372
+ /// [`end()`] are unspecified after the iteration ended. To determine
373
+ /// whether the inclusive range is empty, use the [`is_empty()`] method
374
+ /// instead of comparing `start() > end()`.
375
+ ///
376
+ /// [`end()`]: #method.end
377
+ /// [`is_empty()`]: #method.is_empty
378
+ ///
371
379
/// # Examples
372
380
///
373
381
/// ```
@@ -383,6 +391,14 @@ impl<Idx> RangeInclusive<Idx> {
383
391
384
392
/// Returns the upper bound of the range (inclusive).
385
393
///
394
+ /// When using an inclusive range for iteration, the values of [`start()`]
395
+ /// and `end()` are unspecified after the iteration ended. To determine
396
+ /// whether the inclusive range is empty, use the [`is_empty()`] method
397
+ /// instead of comparing `start() > end()`.
398
+ ///
399
+ /// [`start()`]: #method.start
400
+ /// [`is_empty()`]: #method.is_empty
401
+ ///
386
402
/// # Examples
387
403
///
388
404
/// ```
You can’t perform that action at this time.
0 commit comments