@@ -433,8 +433,9 @@ impl<T> [T] {
433
433
/// assert_eq!(x, &[3, 4, 6]);
434
434
/// ```
435
435
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
436
+ #[ rustc_const_unstable( feature = "const_ptr_offset" , issue = "71499" ) ]
436
437
#[ inline]
437
- pub fn as_mut_ptr ( & mut self ) -> * mut T {
438
+ pub const fn as_mut_ptr ( & mut self ) -> * mut T {
438
439
self as * mut [ T ] as * mut T
439
440
}
440
441
@@ -469,8 +470,9 @@ impl<T> [T] {
469
470
///
470
471
/// [`as_ptr`]: #method.as_ptr
471
472
#[ unstable( feature = "slice_ptr_range" , issue = "65807" ) ]
473
+ #[ rustc_const_unstable( feature = "const_ptr_offset" , issue = "71499" ) ]
472
474
#[ inline]
473
- pub fn as_ptr_range ( & self ) -> Range < * const T > {
475
+ pub const fn as_ptr_range ( & self ) -> Range < * const T > {
474
476
let start = self . as_ptr ( ) ;
475
477
// SAFETY: The `add` here is safe, because:
476
478
//
@@ -510,8 +512,9 @@ impl<T> [T] {
510
512
///
511
513
/// [`as_mut_ptr`]: #method.as_mut_ptr
512
514
#[ unstable( feature = "slice_ptr_range" , issue = "65807" ) ]
515
+ #[ rustc_const_unstable( feature = "const_ptr_offset" , issue = "71499" ) ]
513
516
#[ inline]
514
- pub fn as_mut_ptr_range ( & mut self ) -> Range < * mut T > {
517
+ pub const fn as_mut_ptr_range ( & mut self ) -> Range < * mut T > {
515
518
let start = self . as_mut_ptr ( ) ;
516
519
// SAFETY: See as_ptr_range() above for why `add` here is safe.
517
520
let end = unsafe { start. add ( self . len ( ) ) } ;
0 commit comments