about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRalf Jung <post@ralfj.de>2018-05-07 13:56:24 +0200
committerRalf Jung <post@ralfj.de>2018-05-07 13:56:24 +0200
commit8619e19dc485185fee09baebf5788e427d0036e9 (patch)
treee9e6143af89155d28765994048b257bc240c8303
parent17206a7e64a3f3c8bb63e099e837ba7cda07947e (diff)
downloadrust-8619e19dc485185fee09baebf5788e427d0036e9.tar.gz
rust-8619e19dc485185fee09baebf5788e427d0036e9.zip
Rename PinMut::borrow to PinMut::reborrow and make it a method
-rw-r--r--src/libcore/mem.rs9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/libcore/mem.rs b/src/libcore/mem.rs
index 74eb219e45d..6cbe26afae9 100644
--- a/src/libcore/mem.rs
+++ b/src/libcore/mem.rs
@@ -1129,10 +1129,13 @@ impl<'a, T: ?Sized> 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`.