about summary refs log tree commit diff
path: root/src/liballoc
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2018-05-08 14:45:16 +0000
committerbors <bors@rust-lang.org>2018-05-08 14:45:16 +0000
commitc166b0386888b253313e1e7e982a2a06cadaac8b (patch)
treed15d462362c9be390bfe8bd16455c73d34233c90 /src/liballoc
parentb183bd0ad40b0188fc242bfb9f68a0cf1704dbd9 (diff)
parent939c25a522ddeaae60f905c787a1f28ceb5d7ee8 (diff)
downloadrust-c166b0386888b253313e1e7e982a2a06cadaac8b.tar.gz
rust-c166b0386888b253313e1e7e982a2a06cadaac8b.zip
Auto merge of #50497 - RalfJung:pinmut, r=withoutboats
Rename Pin to PinMut, and some more breaking changes

As discussed at [1] ยง3 and [2] and [3], a formal look at pinning requires considering a distinguished "shared pinned" mode/typestate.  Given that, it seems desirable to at least eventually actually expose that typestate as a reference type.  This renames Pin to PinMut, freeing the name Pin in case we want to use it for a shared pinned reference later on.

[1] https://www.ralfj.de/blog/2018/04/10/safe-intrusive-collections-with-pinning.html
[2] https://github.com/rust-lang/rfcs/pull/2349#issuecomment-379250361
[3] https://github.com/rust-lang/rust/issues/49150#issuecomment-380488275

Cc @withoutboats
Diffstat (limited to 'src/liballoc')
-rw-r--r--src/liballoc/boxed.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/liballoc/boxed.rs b/src/liballoc/boxed.rs
index 1b4f86dcfac..a1567344235 100644
--- a/src/liballoc/boxed.rs
+++ b/src/liballoc/boxed.rs
@@ -62,7 +62,7 @@ use core::fmt;
 use core::hash::{Hash, Hasher};
 use core::iter::FusedIterator;
 use core::marker::{Unpin, Unsize};
-use core::mem::{self, Pin};
+use core::mem::{self, PinMut};
 use core::ops::{CoerceUnsized, Deref, DerefMut, Generator, GeneratorState};
 use core::ptr::{self, NonNull, Unique};
 use core::convert::From;
@@ -771,8 +771,8 @@ impl<T> PinBox<T> {
 #[unstable(feature = "pin", issue = "49150")]
 impl<T: ?Sized> PinBox<T> {
     /// Get a pinned reference to the data in this PinBox.
-    pub fn as_pin<'a>(&'a mut self) -> Pin<'a, T> {
-        unsafe { Pin::new_unchecked(&mut *self.inner) }
+    pub fn as_pin_mut<'a>(&'a mut self) -> PinMut<'a, T> {
+        unsafe { PinMut::new_unchecked(&mut *self.inner) }
     }
 
     /// Get a mutable reference to the data inside this PinBox.