@@ -568,9 +568,10 @@ impl<T> [T] {
568568 #[ rustc_no_implicit_autorefs]
569569 #[ inline]
570570 #[ must_use]
571- pub fn get < I > ( & self , index : I ) -> Option < & I :: Output >
571+ #[ rustc_const_unstable( feature = "const_index" , issue = "143775" ) ]
572+ pub const fn get < I > ( & self , index : I ) -> Option < & I :: Output >
572573 where
573- I : SliceIndex < Self > ,
574+ I : ~ const SliceIndex < Self > ,
574575 {
575576 index. get ( self )
576577 }
@@ -594,9 +595,10 @@ impl<T> [T] {
594595 #[ rustc_no_implicit_autorefs]
595596 #[ inline]
596597 #[ must_use]
597- pub fn get_mut < I > ( & mut self , index : I ) -> Option < & mut I :: Output >
598+ #[ rustc_const_unstable( feature = "const_index" , issue = "143775" ) ]
599+ pub const fn get_mut < I > ( & mut self , index : I ) -> Option < & mut I :: Output >
598600 where
599- I : SliceIndex < Self > ,
601+ I : ~ const SliceIndex < Self > ,
600602 {
601603 index. get_mut ( self )
602604 }
@@ -633,9 +635,10 @@ impl<T> [T] {
633635 #[ inline]
634636 #[ must_use]
635637 #[ track_caller]
636- pub unsafe fn get_unchecked < I > ( & self , index : I ) -> & I :: Output
638+ #[ rustc_const_unstable( feature = "const_index" , issue = "143775" ) ]
639+ pub const unsafe fn get_unchecked < I > ( & self , index : I ) -> & I :: Output
637640 where
638- I : SliceIndex < Self > ,
641+ I : ~ const SliceIndex < Self > ,
639642 {
640643 // SAFETY: the caller must uphold most of the safety requirements for `get_unchecked`;
641644 // the slice is dereferenceable because `self` is a safe reference.
@@ -677,9 +680,10 @@ impl<T> [T] {
677680 #[ inline]
678681 #[ must_use]
679682 #[ track_caller]
680- pub unsafe fn get_unchecked_mut < I > ( & mut self , index : I ) -> & mut I :: Output
683+ #[ rustc_const_unstable( feature = "const_index" , issue = "143775" ) ]
684+ pub const unsafe fn get_unchecked_mut < I > ( & mut self , index : I ) -> & mut I :: Output
681685 where
682- I : SliceIndex < Self > ,
686+ I : ~ const SliceIndex < Self > ,
683687 {
684688 // SAFETY: the caller must uphold the safety requirements for `get_unchecked_mut`;
685689 // the slice is dereferenceable because `self` is a safe reference.
0 commit comments