@@ -588,14 +588,12 @@ impl<Idx: PartialOrd<Idx>> RangeToInclusive<Idx> {
588588/// `Bound`s are range endpoints:
589589///
590590/// ```
591- /// #![feature(collections_range)]
592- ///
593591/// use std::ops::Bound::*;
594592/// use std::ops::RangeBounds;
595593///
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));
599597/// ```
600598///
601599/// Using a tuple of `Bound`s as an argument to [`BTreeMap::range`].
@@ -632,9 +630,7 @@ pub enum Bound<T> {
632630 Unbounded ,
633631}
634632
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" ) ]
638634/// `RangeBounds` is implemented by Rust's built-in range types, produced
639635/// by range syntax like `..`, `a..`, `..b` or `c..d`.
640636pub trait RangeBounds < T : ?Sized > {
@@ -645,17 +641,16 @@ pub trait RangeBounds<T: ?Sized> {
645641 /// # Examples
646642 ///
647643 /// ```
648- /// #![feature(collections_range)]
649- ///
650644 /// # fn main() {
651645 /// use std::ops::Bound::*;
652646 /// use std::ops::RangeBounds;
653647 ///
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));
656650 /// # }
657651 /// ```
658- fn start ( & self ) -> Bound < & T > ;
652+ #[ stable( feature = "collections_range" , since = "1.28.0" ) ]
653+ fn start_bound ( & self ) -> Bound < & T > ;
659654
660655 /// End index bound.
661656 ///
@@ -664,17 +659,16 @@ pub trait RangeBounds<T: ?Sized> {
664659 /// # Examples
665660 ///
666661 /// ```
667- /// #![feature(collections_range)]
668- ///
669662 /// # fn main() {
670663 /// use std::ops::Bound::*;
671664 /// use std::ops::RangeBounds;
672665 ///
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));
675668 /// # }
676669 /// ```
677- fn end ( & self ) -> Bound < & T > ;
670+ #[ stable( feature = "collections_range" , since = "1.28.0" ) ]
671+ fn end_bound ( & self ) -> Bound < & T > ;
678672
679673
680674 /// Returns `true` if `item` is contained in the range.
@@ -699,13 +693,13 @@ pub trait RangeBounds<T: ?Sized> {
699693 T : PartialOrd < U > ,
700694 U : ?Sized + PartialOrd < T > ,
701695 {
702- ( match self . start ( ) {
696+ ( match self . start_bound ( ) {
703697 Included ( ref start) => * start <= item,
704698 Excluded ( ref start) => * start < item,
705699 Unbounded => true ,
706700 } )
707701 &&
708- ( match self . end ( ) {
702+ ( match self . end_bound ( ) {
709703 Included ( ref end) => item <= * end,
710704 Excluded ( ref end) => item < * end,
711705 Unbounded => true ,
@@ -715,91 +709,77 @@ pub trait RangeBounds<T: ?Sized> {
715709
716710use self :: Bound :: { Excluded , Included , Unbounded } ;
717711
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" ) ]
721713impl < T : ?Sized > RangeBounds < T > for RangeFull {
722- fn start ( & self ) -> Bound < & T > {
714+ fn start_bound ( & self ) -> Bound < & T > {
723715 Unbounded
724716 }
725- fn end ( & self ) -> Bound < & T > {
717+ fn end_bound ( & self ) -> Bound < & T > {
726718 Unbounded
727719 }
728720}
729721
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" ) ]
733723impl < T > RangeBounds < T > for RangeFrom < T > {
734- fn start ( & self ) -> Bound < & T > {
724+ fn start_bound ( & self ) -> Bound < & T > {
735725 Included ( & self . start )
736726 }
737- fn end ( & self ) -> Bound < & T > {
727+ fn end_bound ( & self ) -> Bound < & T > {
738728 Unbounded
739729 }
740730}
741731
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" ) ]
745733impl < T > RangeBounds < T > for RangeTo < T > {
746- fn start ( & self ) -> Bound < & T > {
734+ fn start_bound ( & self ) -> Bound < & T > {
747735 Unbounded
748736 }
749- fn end ( & self ) -> Bound < & T > {
737+ fn end_bound ( & self ) -> Bound < & T > {
750738 Excluded ( & self . end )
751739 }
752740}
753741
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" ) ]
757743impl < T > RangeBounds < T > for Range < T > {
758- fn start ( & self ) -> Bound < & T > {
744+ fn start_bound ( & self ) -> Bound < & T > {
759745 Included ( & self . start )
760746 }
761- fn end ( & self ) -> Bound < & T > {
747+ fn end_bound ( & self ) -> Bound < & T > {
762748 Excluded ( & self . end )
763749 }
764750}
765751
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" ) ]
769753impl < T > RangeBounds < T > for RangeInclusive < T > {
770- fn start ( & self ) -> Bound < & T > {
754+ fn start_bound ( & self ) -> Bound < & T > {
771755 Included ( & self . start )
772756 }
773- fn end ( & self ) -> Bound < & T > {
757+ fn end_bound ( & self ) -> Bound < & T > {
774758 Included ( & self . end )
775759 }
776760}
777761
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" ) ]
781763impl < T > RangeBounds < T > for RangeToInclusive < T > {
782- fn start ( & self ) -> Bound < & T > {
764+ fn start_bound ( & self ) -> Bound < & T > {
783765 Unbounded
784766 }
785- fn end ( & self ) -> Bound < & T > {
767+ fn end_bound ( & self ) -> Bound < & T > {
786768 Included ( & self . end )
787769 }
788770}
789771
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" ) ]
793773impl < T > RangeBounds < T > for ( Bound < T > , Bound < T > ) {
794- fn start ( & self ) -> Bound < & T > {
774+ fn start_bound ( & self ) -> Bound < & T > {
795775 match * self {
796776 ( Included ( ref start) , _) => Included ( start) ,
797777 ( Excluded ( ref start) , _) => Excluded ( start) ,
798778 ( Unbounded , _) => Unbounded ,
799779 }
800780 }
801781
802- fn end ( & self ) -> Bound < & T > {
782+ fn end_bound ( & self ) -> Bound < & T > {
803783 match * self {
804784 ( _, Included ( ref end) ) => Included ( end) ,
805785 ( _, Excluded ( ref end) ) => Excluded ( end) ,
@@ -808,75 +788,63 @@ impl<T> RangeBounds<T> for (Bound<T>, Bound<T>) {
808788 }
809789}
810790
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" ) ]
814792impl < ' 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 > {
816794 self . 0
817795 }
818796
819- fn end ( & self ) -> Bound < & T > {
797+ fn end_bound ( & self ) -> Bound < & T > {
820798 self . 1
821799 }
822800}
823801
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" ) ]
827803impl < ' a , T > RangeBounds < T > for RangeFrom < & ' a T > {
828- fn start ( & self ) -> Bound < & T > {
804+ fn start_bound ( & self ) -> Bound < & T > {
829805 Included ( self . start )
830806 }
831- fn end ( & self ) -> Bound < & T > {
807+ fn end_bound ( & self ) -> Bound < & T > {
832808 Unbounded
833809 }
834810}
835811
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" ) ]
839813impl < ' a , T > RangeBounds < T > for RangeTo < & ' a T > {
840- fn start ( & self ) -> Bound < & T > {
814+ fn start_bound ( & self ) -> Bound < & T > {
841815 Unbounded
842816 }
843- fn end ( & self ) -> Bound < & T > {
817+ fn end_bound ( & self ) -> Bound < & T > {
844818 Excluded ( self . end )
845819 }
846820}
847821
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" ) ]
851823impl < ' a , T > RangeBounds < T > for Range < & ' a T > {
852- fn start ( & self ) -> Bound < & T > {
824+ fn start_bound ( & self ) -> Bound < & T > {
853825 Included ( self . start )
854826 }
855- fn end ( & self ) -> Bound < & T > {
827+ fn end_bound ( & self ) -> Bound < & T > {
856828 Excluded ( self . end )
857829 }
858830}
859831
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" ) ]
863833impl < ' a , T > RangeBounds < T > for RangeInclusive < & ' a T > {
864- fn start ( & self ) -> Bound < & T > {
834+ fn start_bound ( & self ) -> Bound < & T > {
865835 Included ( self . start )
866836 }
867- fn end ( & self ) -> Bound < & T > {
837+ fn end_bound ( & self ) -> Bound < & T > {
868838 Included ( self . end )
869839 }
870840}
871841
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" ) ]
875843impl < ' a , T > RangeBounds < T > for RangeToInclusive < & ' a T > {
876- fn start ( & self ) -> Bound < & T > {
844+ fn start_bound ( & self ) -> Bound < & T > {
877845 Unbounded
878846 }
879- fn end ( & self ) -> Bound < & T > {
847+ fn end_bound ( & self ) -> Bound < & T > {
880848 Included ( self . end )
881849 }
882850}
0 commit comments