@@ -103,7 +103,7 @@ impl<T: Sized> NonNull<T> {
103
103
/// [the module documentation]: crate::ptr#safety
104
104
#[ inline]
105
105
#[ unstable( feature = "ptr_as_uninit" , issue = "75402" ) ]
106
- pub unsafe fn as_uninit_ref ( & self ) -> & MaybeUninit < T > {
106
+ pub unsafe fn as_uninit_ref < ' a > ( & self ) -> & ' a MaybeUninit < T > {
107
107
// SAFETY: the caller must guarantee that `self` meets all the
108
108
// requirements for a reference.
109
109
unsafe { & * self . cast ( ) . as_ptr ( ) }
@@ -135,7 +135,7 @@ impl<T: Sized> NonNull<T> {
135
135
/// [the module documentation]: crate::ptr#safety
136
136
#[ inline]
137
137
#[ unstable( feature = "ptr_as_uninit" , issue = "75402" ) ]
138
- pub unsafe fn as_uninit_mut ( & mut self ) -> & mut MaybeUninit < T > {
138
+ pub unsafe fn as_uninit_mut < ' a > ( & mut self ) -> & ' a mut MaybeUninit < T > {
139
139
// SAFETY: the caller must guarantee that `self` meets all the
140
140
// requirements for a reference.
141
141
unsafe { & mut * self . cast ( ) . as_ptr ( ) }
@@ -206,7 +206,7 @@ impl<T: ?Sized> NonNull<T> {
206
206
/// [the module documentation]: crate::ptr#safety
207
207
#[ stable( feature = "nonnull" , since = "1.25.0" ) ]
208
208
#[ inline]
209
- pub unsafe fn as_ref ( & self ) -> & T {
209
+ pub unsafe fn as_ref < ' a > ( & self ) -> & ' a T {
210
210
// SAFETY: the caller must guarantee that `self` meets all the
211
211
// requirements for a reference.
212
212
unsafe { & * self . as_ptr ( ) }
@@ -242,7 +242,7 @@ impl<T: ?Sized> NonNull<T> {
242
242
/// [the module documentation]: crate::ptr#safety
243
243
#[ stable( feature = "nonnull" , since = "1.25.0" ) ]
244
244
#[ inline]
245
- pub unsafe fn as_mut ( & mut self ) -> & mut T {
245
+ pub unsafe fn as_mut < ' a > ( & mut self ) -> & ' a mut T {
246
246
// SAFETY: the caller must guarantee that `self` meets all the
247
247
// requirements for a mutable reference.
248
248
unsafe { & mut * self . as_ptr ( ) }
@@ -390,7 +390,7 @@ impl<T> NonNull<[T]> {
390
390
/// [`pointer::offset`]: ../../std/primitive.pointer.html#method.offset
391
391
#[ inline]
392
392
#[ unstable( feature = "ptr_as_uninit" , issue = "75402" ) ]
393
- pub unsafe fn as_uninit_slice ( & self ) -> & [ MaybeUninit < T > ] {
393
+ pub unsafe fn as_uninit_slice < ' a > ( & self ) -> & ' a [ MaybeUninit < T > ] {
394
394
// SAFETY: the caller must uphold the safety contract for `as_uninit_slice`.
395
395
unsafe { slice:: from_raw_parts ( self . cast ( ) . as_ptr ( ) , self . len ( ) ) }
396
396
}
@@ -452,7 +452,7 @@ impl<T> NonNull<[T]> {
452
452
/// ```
453
453
#[ inline]
454
454
#[ unstable( feature = "ptr_as_uninit" , issue = "75402" ) ]
455
- pub unsafe fn as_uninit_slice_mut ( & self ) -> & mut [ MaybeUninit < T > ] {
455
+ pub unsafe fn as_uninit_slice_mut < ' a > ( & self ) -> & ' a mut [ MaybeUninit < T > ] {
456
456
// SAFETY: the caller must uphold the safety contract for `as_uninit_slice_mut`.
457
457
unsafe { slice:: from_raw_parts_mut ( self . cast ( ) . as_ptr ( ) , self . len ( ) ) }
458
458
}
0 commit comments