File tree 1 file changed +8
-0
lines changed
1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -751,6 +751,8 @@ pub trait RangeBounds<T: ?Sized> {
751
751
/// ```
752
752
/// #![feature(range_bounds_for_length)]
753
753
///
754
+ /// use std::ops::RangeBounds;
755
+ ///
754
756
/// let v = [10, 40, 30];
755
757
/// assert_eq!(1..2, (1..2).for_length(v.len()));
756
758
/// assert_eq!(0..2, (..2).for_length(v.len()));
@@ -762,18 +764,24 @@ pub trait RangeBounds<T: ?Sized> {
762
764
/// ```should_panic
763
765
/// #![feature(range_bounds_for_length)]
764
766
///
767
+ /// use std::ops::RangeBounds;
768
+ ///
765
769
/// (2..1).for_length(3);
766
770
/// ```
767
771
///
768
772
/// ```should_panic
769
773
/// #![feature(range_bounds_for_length)]
770
774
///
775
+ /// use std::ops::RangeBounds;
776
+ ///
771
777
/// (1..4).for_length(3);
772
778
/// ```
773
779
///
774
780
/// ```should_panic
775
781
/// #![feature(range_bounds_for_length)]
776
782
///
783
+ /// use std::ops::RangeBounds;
784
+ ///
777
785
/// (1..=usize::MAX).for_length(3);
778
786
/// ```
779
787
///
You can’t perform that action at this time.
0 commit comments