Skip to content

Commit 3a046ff

Browse files
committed
Elide lifetimes in Pin<&(mut) Self>
1 parent a44881d commit 3a046ff

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/libcore/option.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ impl<T> Option<T> {
295295
/// [`Pin`]: ../pin/struct.Pin.html
296296
#[inline]
297297
#[stable(feature = "pin", since = "1.33.0")]
298-
pub fn as_pin_ref<'a>(self: Pin<&'a Option<T>>) -> Option<Pin<&'a T>> {
298+
pub fn as_pin_ref(self: Pin<&Self>) -> Option<Pin<&T>> {
299299
unsafe {
300300
Pin::get_ref(self).as_ref().map(|x| Pin::new_unchecked(x))
301301
}
@@ -306,7 +306,7 @@ impl<T> Option<T> {
306306
/// [`Pin`]: ../pin/struct.Pin.html
307307
#[inline]
308308
#[stable(feature = "pin", since = "1.33.0")]
309-
pub fn as_pin_mut<'a>(self: Pin<&'a mut Option<T>>) -> Option<Pin<&'a mut T>> {
309+
pub fn as_pin_mut(self: Pin<&mut Self>) -> Option<Pin<&mut T>> {
310310
unsafe {
311311
Pin::get_unchecked_mut(self).as_mut().map(|x| Pin::new_unchecked(x))
312312
}

src/libcore/pin.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@
233233
//! # type Field = i32;
234234
//! # struct Struct { field: Field }
235235
//! impl Struct {
236-
//! fn pin_get_field<'a>(self: Pin<&'a mut Self>) -> &'a mut Field {
236+
//! fn pin_get_field(self: Pin<&mut Self>) -> &mut Field {
237237
//! // This is okay because `field` is never considered pinned.
238238
//! unsafe { &mut self.get_unchecked_mut().field }
239239
//! }
@@ -257,7 +257,7 @@
257257
//! # type Field = i32;
258258
//! # struct Struct { field: Field }
259259
//! impl Struct {
260-
//! fn pin_get_field<'a>(self: Pin<&'a mut Self>) -> Pin<&'a mut Field> {
260+
//! fn pin_get_field(self: Pin<&mut Self>) -> Pin<&mut Field> {
261261
//! // This is okay because `field` is pinned when `self` is.
262262
//! unsafe { self.map_unchecked_mut(|s| &mut s.field) }
263263
//! }

0 commit comments

Comments
 (0)