@@ -97,8 +97,7 @@ pub trait SliceExt {
9797
9898 #[ stable( feature = "core" , since = "1.6.0" ) ]
9999 fn get < I > ( & self , index : I ) -> Option < & I :: Output >
100- where I : SliceIndex < Self :: Item > ;
101-
100+ where I : SliceIndex < Self > ;
102101 #[ stable( feature = "core" , since = "1.6.0" ) ]
103102 fn first ( & self ) -> Option < & Self :: Item > ;
104103
@@ -113,8 +112,7 @@ pub trait SliceExt {
113112
114113 #[ stable( feature = "core" , since = "1.6.0" ) ]
115114 unsafe fn get_unchecked < I > ( & self , index : I ) -> & I :: Output
116- where I : SliceIndex < Self :: Item > ;
117-
115+ where I : SliceIndex < Self > ;
118116 #[ stable( feature = "core" , since = "1.6.0" ) ]
119117 fn as_ptr ( & self ) -> * const Self :: Item ;
120118
@@ -141,8 +139,7 @@ pub trait SliceExt {
141139
142140 #[ stable( feature = "core" , since = "1.6.0" ) ]
143141 fn get_mut < I > ( & mut self , index : I ) -> Option < & mut I :: Output >
144- where I : SliceIndex < Self :: Item > ;
145-
142+ where I : SliceIndex < Self > ;
146143 #[ stable( feature = "core" , since = "1.6.0" ) ]
147144 fn iter_mut ( & mut self ) -> IterMut < Self :: Item > ;
148145
@@ -184,8 +181,7 @@ pub trait SliceExt {
184181
185182 #[ stable( feature = "core" , since = "1.6.0" ) ]
186183 unsafe fn get_unchecked_mut < I > ( & mut self , index : I ) -> & mut I :: Output
187- where I : SliceIndex < Self :: Item > ;
188-
184+ where I : SliceIndex < Self > ;
189185 #[ stable( feature = "core" , since = "1.6.0" ) ]
190186 fn as_mut_ptr ( & mut self ) -> * mut Self :: Item ;
191187
@@ -337,7 +333,7 @@ impl<T> SliceExt for [T] {
337333
338334 #[ inline]
339335 fn get < I > ( & self , index : I ) -> Option < & I :: Output >
340- where I : SliceIndex < T >
336+ where I : SliceIndex < [ T ] >
341337 {
342338 index. get ( self )
343339 }
@@ -365,7 +361,7 @@ impl<T> SliceExt for [T] {
365361
366362 #[ inline]
367363 unsafe fn get_unchecked < I > ( & self , index : I ) -> & I :: Output
368- where I : SliceIndex < T >
364+ where I : SliceIndex < [ T ] >
369365 {
370366 index. get_unchecked ( self )
371367 }
@@ -406,7 +402,7 @@ impl<T> SliceExt for [T] {
406402
407403 #[ inline]
408404 fn get_mut < I > ( & mut self , index : I ) -> Option < & mut I :: Output >
409- where I : SliceIndex < T >
405+ where I : SliceIndex < [ T ] >
410406 {
411407 index. get_mut ( self )
412408 }
@@ -538,7 +534,7 @@ impl<T> SliceExt for [T] {
538534
539535 #[ inline]
540536 unsafe fn get_unchecked_mut < I > ( & mut self , index : I ) -> & mut I :: Output
541- where I : SliceIndex < T >
537+ where I : SliceIndex < [ T ] >
542538 {
543539 index. get_unchecked_mut ( self )
544540 }
@@ -631,7 +627,7 @@ impl<T> SliceExt for [T] {
631627#[ stable( feature = "rust1" , since = "1.0.0" ) ]
632628#[ rustc_on_unimplemented = "slice indices are of type `usize` or ranges of `usize`" ]
633629impl < T , I > ops:: Index < I > for [ T ]
634- where I : SliceIndex < T >
630+ where I : SliceIndex < [ T ] >
635631{
636632 type Output = I :: Output ;
637633
@@ -644,7 +640,7 @@ impl<T, I> ops::Index<I> for [T]
644640#[ stable( feature = "rust1" , since = "1.0.0" ) ]
645641#[ rustc_on_unimplemented = "slice indices are of type `usize` or ranges of `usize`" ]
646642impl < T , I > ops:: IndexMut < I > for [ T ]
647- where I : SliceIndex < T >
643+ where I : SliceIndex < [ T ] >
648644{
649645 #[ inline]
650646 fn index_mut ( & mut self , index : I ) -> & mut I :: Output {
@@ -667,37 +663,37 @@ fn slice_index_order_fail(index: usize, end: usize) -> ! {
667663/// A helper trait used for indexing operations.
668664#[ unstable( feature = "slice_get_slice" , issue = "35729" ) ]
669665#[ rustc_on_unimplemented = "slice indices are of type `usize` or ranges of `usize`" ]
670- pub trait SliceIndex < T > {
666+ pub trait SliceIndex < T : ? Sized > {
671667 /// The output type returned by methods.
672668 type Output : ?Sized ;
673669
674670 /// Returns a shared reference to the output at this location, if in
675671 /// bounds.
676- fn get ( self , slice : & [ T ] ) -> Option < & Self :: Output > ;
672+ fn get ( self , slice : & T ) -> Option < & Self :: Output > ;
677673
678674 /// Returns a mutable reference to the output at this location, if in
679675 /// bounds.
680- fn get_mut ( self , slice : & mut [ T ] ) -> Option < & mut Self :: Output > ;
676+ fn get_mut ( self , slice : & mut T ) -> Option < & mut Self :: Output > ;
681677
682678 /// Returns a shared reference to the output at this location, without
683679 /// performing any bounds checking.
684- unsafe fn get_unchecked ( self , slice : & [ T ] ) -> & Self :: Output ;
680+ unsafe fn get_unchecked ( self , slice : & T ) -> & Self :: Output ;
685681
686682 /// Returns a mutable reference to the output at this location, without
687683 /// performing any bounds checking.
688- unsafe fn get_unchecked_mut ( self , slice : & mut [ T ] ) -> & mut Self :: Output ;
684+ unsafe fn get_unchecked_mut ( self , slice : & mut T ) -> & mut Self :: Output ;
689685
690686 /// Returns a shared reference to the output at this location, panicking
691687 /// if out of bounds.
692- fn index ( self , slice : & [ T ] ) -> & Self :: Output ;
688+ fn index ( self , slice : & T ) -> & Self :: Output ;
693689
694690 /// Returns a mutable reference to the output at this location, panicking
695691 /// if out of bounds.
696- fn index_mut ( self , slice : & mut [ T ] ) -> & mut Self :: Output ;
692+ fn index_mut ( self , slice : & mut T ) -> & mut Self :: Output ;
697693}
698694
699695#[ stable( feature = "slice-get-slice-impls" , since = "1.15.0" ) ]
700- impl < T > SliceIndex < T > for usize {
696+ impl < T > SliceIndex < [ T ] > for usize {
701697 type Output = T ;
702698
703699 #[ inline]
@@ -746,7 +742,7 @@ impl<T> SliceIndex<T> for usize {
746742}
747743
748744#[ stable( feature = "slice-get-slice-impls" , since = "1.15.0" ) ]
749- impl < T > SliceIndex < T > for ops:: Range < usize > {
745+ impl < T > SliceIndex < [ T ] > for ops:: Range < usize > {
750746 type Output = [ T ] ;
751747
752748 #[ inline]
@@ -807,7 +803,7 @@ impl<T> SliceIndex<T> for ops::Range<usize> {
807803}
808804
809805#[ stable( feature = "slice-get-slice-impls" , since = "1.15.0" ) ]
810- impl < T > SliceIndex < T > for ops:: RangeTo < usize > {
806+ impl < T > SliceIndex < [ T ] > for ops:: RangeTo < usize > {
811807 type Output = [ T ] ;
812808
813809 #[ inline]
@@ -842,7 +838,7 @@ impl<T> SliceIndex<T> for ops::RangeTo<usize> {
842838}
843839
844840#[ stable( feature = "slice-get-slice-impls" , since = "1.15.0" ) ]
845- impl < T > SliceIndex < T > for ops:: RangeFrom < usize > {
841+ impl < T > SliceIndex < [ T ] > for ops:: RangeFrom < usize > {
846842 type Output = [ T ] ;
847843
848844 #[ inline]
@@ -877,7 +873,7 @@ impl<T> SliceIndex<T> for ops::RangeFrom<usize> {
877873}
878874
879875#[ stable( feature = "slice-get-slice-impls" , since = "1.15.0" ) ]
880- impl < T > SliceIndex < T > for ops:: RangeFull {
876+ impl < T > SliceIndex < [ T ] > for ops:: RangeFull {
881877 type Output = [ T ] ;
882878
883879 #[ inline]
@@ -913,7 +909,7 @@ impl<T> SliceIndex<T> for ops::RangeFull {
913909
914910
915911#[ unstable( feature = "inclusive_range" , reason = "recently added, follows RFC" , issue = "28237" ) ]
916- impl < T > SliceIndex < T > for ops:: RangeInclusive < usize > {
912+ impl < T > SliceIndex < [ T ] > for ops:: RangeInclusive < usize > {
917913 type Output = [ T ] ;
918914
919915 #[ inline]
@@ -976,7 +972,7 @@ impl<T> SliceIndex<T> for ops::RangeInclusive<usize> {
976972}
977973
978974#[ unstable( feature = "inclusive_range" , reason = "recently added, follows RFC" , issue = "28237" ) ]
979- impl < T > SliceIndex < T > for ops:: RangeToInclusive < usize > {
975+ impl < T > SliceIndex < [ T ] > for ops:: RangeToInclusive < usize > {
980976 type Output = [ T ] ;
981977
982978 #[ inline]
0 commit comments