@@ -588,14 +588,12 @@ impl<Idx: PartialOrd<Idx>> RangeToInclusive<Idx> {
588
588
/// `Bound`s are range endpoints:
589
589
///
590
590
/// ```
591
- /// #![feature(collections_range)]
592
- ///
593
591
/// use std::ops::Bound::*;
594
592
/// use std::ops::RangeBounds;
595
593
///
596
- /// assert_eq!((..100).start (), Unbounded);
597
- /// assert_eq!((1..12).start (), Included(&1));
598
- /// assert_eq!((1..12).end (), Excluded(&12));
594
+ /// assert_eq!((..100).start_bound (), Unbounded);
595
+ /// assert_eq!((1..12).start_bound (), Included(&1));
596
+ /// assert_eq!((1..12).end_bound (), Excluded(&12));
599
597
/// ```
600
598
///
601
599
/// Using a tuple of `Bound`s as an argument to [`BTreeMap::range`].
@@ -632,9 +630,7 @@ pub enum Bound<T> {
632
630
Unbounded ,
633
631
}
634
632
635
- #[ unstable( feature = "collections_range" ,
636
- reason = "might be replaced with `Into<_>` and a type containing two `Bound` values" ,
637
- issue = "30877" ) ]
633
+ #[ stable( feature = "collections_range" , since = "1.28.0" ) ]
638
634
/// `RangeBounds` is implemented by Rust's built-in range types, produced
639
635
/// by range syntax like `..`, `a..`, `..b` or `c..d`.
640
636
pub trait RangeBounds < T : ?Sized > {
@@ -645,17 +641,16 @@ pub trait RangeBounds<T: ?Sized> {
645
641
/// # Examples
646
642
///
647
643
/// ```
648
- /// #![feature(collections_range)]
649
- ///
650
644
/// # fn main() {
651
645
/// use std::ops::Bound::*;
652
646
/// use std::ops::RangeBounds;
653
647
///
654
- /// assert_eq!((..10).start (), Unbounded);
655
- /// assert_eq!((3..10).start (), Included(&3));
648
+ /// assert_eq!((..10).start_bound (), Unbounded);
649
+ /// assert_eq!((3..10).start_bound (), Included(&3));
656
650
/// # }
657
651
/// ```
658
- fn start ( & self ) -> Bound < & T > ;
652
+ #[ stable( feature = "collections_range" , since = "1.28.0" ) ]
653
+ fn start_bound ( & self ) -> Bound < & T > ;
659
654
660
655
/// End index bound.
661
656
///
@@ -664,17 +659,16 @@ pub trait RangeBounds<T: ?Sized> {
664
659
/// # Examples
665
660
///
666
661
/// ```
667
- /// #![feature(collections_range)]
668
- ///
669
662
/// # fn main() {
670
663
/// use std::ops::Bound::*;
671
664
/// use std::ops::RangeBounds;
672
665
///
673
- /// assert_eq!((3..).end (), Unbounded);
674
- /// assert_eq!((3..10).end (), Excluded(&10));
666
+ /// assert_eq!((3..).end_bound (), Unbounded);
667
+ /// assert_eq!((3..10).end_bound (), Excluded(&10));
675
668
/// # }
676
669
/// ```
677
- fn end ( & self ) -> Bound < & T > ;
670
+ #[ stable( feature = "collections_range" , since = "1.28.0" ) ]
671
+ fn end_bound ( & self ) -> Bound < & T > ;
678
672
679
673
680
674
/// Returns `true` if `item` is contained in the range.
@@ -699,13 +693,13 @@ pub trait RangeBounds<T: ?Sized> {
699
693
T : PartialOrd < U > ,
700
694
U : ?Sized + PartialOrd < T > ,
701
695
{
702
- ( match self . start ( ) {
696
+ ( match self . start_bound ( ) {
703
697
Included ( ref start) => * start <= item,
704
698
Excluded ( ref start) => * start < item,
705
699
Unbounded => true ,
706
700
} )
707
701
&&
708
- ( match self . end ( ) {
702
+ ( match self . end_bound ( ) {
709
703
Included ( ref end) => item <= * end,
710
704
Excluded ( ref end) => item < * end,
711
705
Unbounded => true ,
@@ -715,91 +709,77 @@ pub trait RangeBounds<T: ?Sized> {
715
709
716
710
use self :: Bound :: { Excluded , Included , Unbounded } ;
717
711
718
- #[ unstable( feature = "collections_range" ,
719
- reason = "might be replaced with `Into<_>` and a type containing two `Bound` values" ,
720
- issue = "30877" ) ]
712
+ #[ stable( feature = "collections_range" , since = "1.28.0" ) ]
721
713
impl < T : ?Sized > RangeBounds < T > for RangeFull {
722
- fn start ( & self ) -> Bound < & T > {
714
+ fn start_bound ( & self ) -> Bound < & T > {
723
715
Unbounded
724
716
}
725
- fn end ( & self ) -> Bound < & T > {
717
+ fn end_bound ( & self ) -> Bound < & T > {
726
718
Unbounded
727
719
}
728
720
}
729
721
730
- #[ unstable( feature = "collections_range" ,
731
- reason = "might be replaced with `Into<_>` and a type containing two `Bound` values" ,
732
- issue = "30877" ) ]
722
+ #[ stable( feature = "collections_range" , since = "1.28.0" ) ]
733
723
impl < T > RangeBounds < T > for RangeFrom < T > {
734
- fn start ( & self ) -> Bound < & T > {
724
+ fn start_bound ( & self ) -> Bound < & T > {
735
725
Included ( & self . start )
736
726
}
737
- fn end ( & self ) -> Bound < & T > {
727
+ fn end_bound ( & self ) -> Bound < & T > {
738
728
Unbounded
739
729
}
740
730
}
741
731
742
- #[ unstable( feature = "collections_range" ,
743
- reason = "might be replaced with `Into<_>` and a type containing two `Bound` values" ,
744
- issue = "30877" ) ]
732
+ #[ stable( feature = "collections_range" , since = "1.28.0" ) ]
745
733
impl < T > RangeBounds < T > for RangeTo < T > {
746
- fn start ( & self ) -> Bound < & T > {
734
+ fn start_bound ( & self ) -> Bound < & T > {
747
735
Unbounded
748
736
}
749
- fn end ( & self ) -> Bound < & T > {
737
+ fn end_bound ( & self ) -> Bound < & T > {
750
738
Excluded ( & self . end )
751
739
}
752
740
}
753
741
754
- #[ unstable( feature = "collections_range" ,
755
- reason = "might be replaced with `Into<_>` and a type containing two `Bound` values" ,
756
- issue = "30877" ) ]
742
+ #[ stable( feature = "collections_range" , since = "1.28.0" ) ]
757
743
impl < T > RangeBounds < T > for Range < T > {
758
- fn start ( & self ) -> Bound < & T > {
744
+ fn start_bound ( & self ) -> Bound < & T > {
759
745
Included ( & self . start )
760
746
}
761
- fn end ( & self ) -> Bound < & T > {
747
+ fn end_bound ( & self ) -> Bound < & T > {
762
748
Excluded ( & self . end )
763
749
}
764
750
}
765
751
766
- #[ unstable( feature = "collections_range" ,
767
- reason = "might be replaced with `Into<_>` and a type containing two `Bound` values" ,
768
- issue = "30877" ) ]
752
+ #[ stable( feature = "collections_range" , since = "1.28.0" ) ]
769
753
impl < T > RangeBounds < T > for RangeInclusive < T > {
770
- fn start ( & self ) -> Bound < & T > {
754
+ fn start_bound ( & self ) -> Bound < & T > {
771
755
Included ( & self . start )
772
756
}
773
- fn end ( & self ) -> Bound < & T > {
757
+ fn end_bound ( & self ) -> Bound < & T > {
774
758
Included ( & self . end )
775
759
}
776
760
}
777
761
778
- #[ unstable( feature = "collections_range" ,
779
- reason = "might be replaced with `Into<_>` and a type containing two `Bound` values" ,
780
- issue = "30877" ) ]
762
+ #[ stable( feature = "collections_range" , since = "1.28.0" ) ]
781
763
impl < T > RangeBounds < T > for RangeToInclusive < T > {
782
- fn start ( & self ) -> Bound < & T > {
764
+ fn start_bound ( & self ) -> Bound < & T > {
783
765
Unbounded
784
766
}
785
- fn end ( & self ) -> Bound < & T > {
767
+ fn end_bound ( & self ) -> Bound < & T > {
786
768
Included ( & self . end )
787
769
}
788
770
}
789
771
790
- #[ unstable( feature = "collections_range" ,
791
- reason = "might be replaced with `Into<_>` and a type containing two `Bound` values" ,
792
- issue = "30877" ) ]
772
+ #[ stable( feature = "collections_range" , since = "1.28.0" ) ]
793
773
impl < T > RangeBounds < T > for ( Bound < T > , Bound < T > ) {
794
- fn start ( & self ) -> Bound < & T > {
774
+ fn start_bound ( & self ) -> Bound < & T > {
795
775
match * self {
796
776
( Included ( ref start) , _) => Included ( start) ,
797
777
( Excluded ( ref start) , _) => Excluded ( start) ,
798
778
( Unbounded , _) => Unbounded ,
799
779
}
800
780
}
801
781
802
- fn end ( & self ) -> Bound < & T > {
782
+ fn end_bound ( & self ) -> Bound < & T > {
803
783
match * self {
804
784
( _, Included ( ref end) ) => Included ( end) ,
805
785
( _, Excluded ( ref end) ) => Excluded ( end) ,
@@ -808,75 +788,63 @@ impl<T> RangeBounds<T> for (Bound<T>, Bound<T>) {
808
788
}
809
789
}
810
790
811
- #[ unstable( feature = "collections_range" ,
812
- reason = "might be replaced with `Into<_>` and a type containing two `Bound` values" ,
813
- issue = "30877" ) ]
791
+ #[ stable( feature = "collections_range" , since = "1.28.0" ) ]
814
792
impl < ' a , T : ?Sized + ' a > RangeBounds < T > for ( Bound < & ' a T > , Bound < & ' a T > ) {
815
- fn start ( & self ) -> Bound < & T > {
793
+ fn start_bound ( & self ) -> Bound < & T > {
816
794
self . 0
817
795
}
818
796
819
- fn end ( & self ) -> Bound < & T > {
797
+ fn end_bound ( & self ) -> Bound < & T > {
820
798
self . 1
821
799
}
822
800
}
823
801
824
- #[ unstable( feature = "collections_range" ,
825
- reason = "might be replaced with `Into<_>` and a type containing two `Bound` values" ,
826
- issue = "30877" ) ]
802
+ #[ stable( feature = "collections_range" , since = "1.28.0" ) ]
827
803
impl < ' a , T > RangeBounds < T > for RangeFrom < & ' a T > {
828
- fn start ( & self ) -> Bound < & T > {
804
+ fn start_bound ( & self ) -> Bound < & T > {
829
805
Included ( self . start )
830
806
}
831
- fn end ( & self ) -> Bound < & T > {
807
+ fn end_bound ( & self ) -> Bound < & T > {
832
808
Unbounded
833
809
}
834
810
}
835
811
836
- #[ unstable( feature = "collections_range" ,
837
- reason = "might be replaced with `Into<_>` and a type containing two `Bound` values" ,
838
- issue = "30877" ) ]
812
+ #[ stable( feature = "collections_range" , since = "1.28.0" ) ]
839
813
impl < ' a , T > RangeBounds < T > for RangeTo < & ' a T > {
840
- fn start ( & self ) -> Bound < & T > {
814
+ fn start_bound ( & self ) -> Bound < & T > {
841
815
Unbounded
842
816
}
843
- fn end ( & self ) -> Bound < & T > {
817
+ fn end_bound ( & self ) -> Bound < & T > {
844
818
Excluded ( self . end )
845
819
}
846
820
}
847
821
848
- #[ unstable( feature = "collections_range" ,
849
- reason = "might be replaced with `Into<_>` and a type containing two `Bound` values" ,
850
- issue = "30877" ) ]
822
+ #[ stable( feature = "collections_range" , since = "1.28.0" ) ]
851
823
impl < ' a , T > RangeBounds < T > for Range < & ' a T > {
852
- fn start ( & self ) -> Bound < & T > {
824
+ fn start_bound ( & self ) -> Bound < & T > {
853
825
Included ( self . start )
854
826
}
855
- fn end ( & self ) -> Bound < & T > {
827
+ fn end_bound ( & self ) -> Bound < & T > {
856
828
Excluded ( self . end )
857
829
}
858
830
}
859
831
860
- #[ unstable( feature = "collections_range" ,
861
- reason = "might be replaced with `Into<_>` and a type containing two `Bound` values" ,
862
- issue = "30877" ) ]
832
+ #[ stable( feature = "collections_range" , since = "1.28.0" ) ]
863
833
impl < ' a , T > RangeBounds < T > for RangeInclusive < & ' a T > {
864
- fn start ( & self ) -> Bound < & T > {
834
+ fn start_bound ( & self ) -> Bound < & T > {
865
835
Included ( self . start )
866
836
}
867
- fn end ( & self ) -> Bound < & T > {
837
+ fn end_bound ( & self ) -> Bound < & T > {
868
838
Included ( self . end )
869
839
}
870
840
}
871
841
872
- #[ unstable( feature = "collections_range" ,
873
- reason = "might be replaced with `Into<_>` and a type containing two `Bound` values" ,
874
- issue = "30877" ) ]
842
+ #[ stable( feature = "collections_range" , since = "1.28.0" ) ]
875
843
impl < ' a , T > RangeBounds < T > for RangeToInclusive < & ' a T > {
876
- fn start ( & self ) -> Bound < & T > {
844
+ fn start_bound ( & self ) -> Bound < & T > {
877
845
Unbounded
878
846
}
879
- fn end ( & self ) -> Bound < & T > {
847
+ fn end_bound ( & self ) -> Bound < & T > {
880
848
Included ( self . end )
881
849
}
882
850
}
0 commit comments