diff options
| author | Taiki Endo <te316e89@gmail.com> | 2019-09-17 08:39:34 +0900 |
|---|---|---|
| committer | Taiki Endo <te316e89@gmail.com> | 2019-09-17 08:39:34 +0900 |
| commit | 3a046ffa71ae9a991479a435a451b528ee4f71f0 (patch) | |
| tree | b405647225ae513f23ad8497fd8351808a89bac2 /src/libcore | |
| parent | a44881d892fb4f4a8ed93f8f392bab942fac7a41 (diff) | |
| download | rust-3a046ffa71ae9a991479a435a451b528ee4f71f0.tar.gz rust-3a046ffa71ae9a991479a435a451b528ee4f71f0.zip | |
Elide lifetimes in `Pin<&(mut) Self>`
Diffstat (limited to 'src/libcore')
| -rw-r--r-- | src/libcore/option.rs | 4 | ||||
| -rw-r--r-- | src/libcore/pin.rs | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/src/libcore/option.rs b/src/libcore/option.rs index 79bd04b7243..5569d99f8d8 100644 --- a/src/libcore/option.rs +++ b/src/libcore/option.rs @@ -295,7 +295,7 @@ impl<T> Option<T> { /// [`Pin`]: ../pin/struct.Pin.html #[inline] #[stable(feature = "pin", since = "1.33.0")] - pub fn as_pin_ref<'a>(self: Pin<&'a Option<T>>) -> Option<Pin<&'a T>> { + pub fn as_pin_ref(self: Pin<&Self>) -> Option<Pin<&T>> { unsafe { Pin::get_ref(self).as_ref().map(|x| Pin::new_unchecked(x)) } @@ -306,7 +306,7 @@ impl<T> Option<T> { /// [`Pin`]: ../pin/struct.Pin.html #[inline] #[stable(feature = "pin", since = "1.33.0")] - pub fn as_pin_mut<'a>(self: Pin<&'a mut Option<T>>) -> Option<Pin<&'a mut T>> { + pub fn as_pin_mut(self: Pin<&mut Self>) -> Option<Pin<&mut T>> { unsafe { Pin::get_unchecked_mut(self).as_mut().map(|x| Pin::new_unchecked(x)) } diff --git a/src/libcore/pin.rs b/src/libcore/pin.rs index 1080fd32a88..bddd477c6d8 100644 --- a/src/libcore/pin.rs +++ b/src/libcore/pin.rs @@ -233,7 +233,7 @@ //! # type Field = i32; //! # struct Struct { field: Field } //! impl Struct { -//! fn pin_get_field<'a>(self: Pin<&'a mut Self>) -> &'a mut Field { +//! fn pin_get_field(self: Pin<&mut Self>) -> &mut Field { //! // This is okay because `field` is never considered pinned. //! unsafe { &mut self.get_unchecked_mut().field } //! } @@ -257,7 +257,7 @@ //! # type Field = i32; //! # struct Struct { field: Field } //! impl Struct { -//! fn pin_get_field<'a>(self: Pin<&'a mut Self>) -> Pin<&'a mut Field> { +//! fn pin_get_field(self: Pin<&mut Self>) -> Pin<&mut Field> { //! // This is okay because `field` is pinned when `self` is. //! unsafe { self.map_unchecked_mut(|s| &mut s.field) } //! } |
