@@ -110,7 +110,7 @@ impl<T: Sized> NonNull<T> {
110110 /// [the module documentation]: crate::ptr#safety
111111 #[ inline]
112112 #[ unstable( feature = "ptr_as_uninit" , issue = "75402" ) ]
113- pub unsafe fn as_uninit_ref ( & self ) -> & MaybeUninit < T > {
113+ pub unsafe fn as_uninit_ref < ' a > ( & self ) -> & ' a MaybeUninit < T > {
114114 // SAFETY: the caller must guarantee that `self` meets all the
115115 // requirements for a reference.
116116 unsafe { & * self . cast ( ) . as_ptr ( ) }
@@ -142,7 +142,7 @@ impl<T: Sized> NonNull<T> {
142142 /// [the module documentation]: crate::ptr#safety
143143 #[ inline]
144144 #[ unstable( feature = "ptr_as_uninit" , issue = "75402" ) ]
145- pub unsafe fn as_uninit_mut ( & mut self ) -> & mut MaybeUninit < T > {
145+ pub unsafe fn as_uninit_mut < ' a > ( & mut self ) -> & ' a mut MaybeUninit < T > {
146146 // SAFETY: the caller must guarantee that `self` meets all the
147147 // requirements for a reference.
148148 unsafe { & mut * self . cast ( ) . as_ptr ( ) }
@@ -244,7 +244,7 @@ impl<T: ?Sized> NonNull<T> {
244244 /// [the module documentation]: crate::ptr#safety
245245 #[ stable( feature = "nonnull" , since = "1.25.0" ) ]
246246 #[ inline]
247- pub unsafe fn as_ref ( & self ) -> & T {
247+ pub unsafe fn as_ref < ' a > ( & self ) -> & ' a T {
248248 // SAFETY: the caller must guarantee that `self` meets all the
249249 // requirements for a reference.
250250 unsafe { & * self . as_ptr ( ) }
@@ -280,7 +280,7 @@ impl<T: ?Sized> NonNull<T> {
280280 /// [the module documentation]: crate::ptr#safety
281281 #[ stable( feature = "nonnull" , since = "1.25.0" ) ]
282282 #[ inline]
283- pub unsafe fn as_mut ( & mut self ) -> & mut T {
283+ pub unsafe fn as_mut < ' a > ( & mut self ) -> & ' a mut T {
284284 // SAFETY: the caller must guarantee that `self` meets all the
285285 // requirements for a mutable reference.
286286 unsafe { & mut * self . as_ptr ( ) }
@@ -427,7 +427,7 @@ impl<T> NonNull<[T]> {
427427 /// [valid]: crate::ptr#safety
428428 #[ inline]
429429 #[ unstable( feature = "ptr_as_uninit" , issue = "75402" ) ]
430- pub unsafe fn as_uninit_slice ( & self ) -> & [ MaybeUninit < T > ] {
430+ pub unsafe fn as_uninit_slice < ' a > ( & self ) -> & ' a [ MaybeUninit < T > ] {
431431 // SAFETY: the caller must uphold the safety contract for `as_uninit_slice`.
432432 unsafe { slice:: from_raw_parts ( self . cast ( ) . as_ptr ( ) , self . len ( ) ) }
433433 }
@@ -488,7 +488,7 @@ impl<T> NonNull<[T]> {
488488 /// ```
489489 #[ inline]
490490 #[ unstable( feature = "ptr_as_uninit" , issue = "75402" ) ]
491- pub unsafe fn as_uninit_slice_mut ( & self ) -> & mut [ MaybeUninit < T > ] {
491+ pub unsafe fn as_uninit_slice_mut < ' a > ( & self ) -> & ' a mut [ MaybeUninit < T > ] {
492492 // SAFETY: the caller must uphold the safety contract for `as_uninit_slice_mut`.
493493 unsafe { slice:: from_raw_parts_mut ( self . cast ( ) . as_ptr ( ) , self . len ( ) ) }
494494 }
0 commit comments