]> git.lizzy.rs Git - rust.git/commitdiff
Rename PinMut::borrow to PinMut::reborrow and make it a method
authorRalf Jung <post@ralfj.de>
Mon, 7 May 2018 11:56:24 +0000 (13:56 +0200)
committerRalf Jung <post@ralfj.de>
Mon, 7 May 2018 11:56:24 +0000 (13:56 +0200)
src/libcore/mem.rs

index 74eb219e45d78f10138a276889393950feea5082..6cbe26afae9eb7c879810f05adfd5dbf3a5c25b2 100644 (file)
@@ -1129,10 +1129,13 @@ pub unsafe fn new_unchecked(reference: &'a mut T) -> PinMut<'a, T> {
         PinMut { inner: reference }
     }
 
-    /// Borrow a PinMut for a shorter lifetime than it already has.
+    /// Reborrow a `PinMut` for a shorter lifetime.
+    ///
+    /// For example, `PinMut::get_mut(x.reborrow())` (unsafely) returns a
+    /// short-lived mutable reference reborrowing from `x`.
     #[unstable(feature = "pin", issue = "49150")]
-    pub fn borrow<'b>(this: &'b mut PinMut<'a, T>) -> PinMut<'b, T> {
-        PinMut { inner: this.inner }
+    pub fn reborrow<'b>(&'b mut self) -> PinMut<'b, T> {
+        PinMut { inner: self.inner }
     }
 
     /// Get a mutable reference to the data inside of this `PinMut`.