diff options
| author | Ralf Jung <post@ralfj.de> | 2018-05-07 12:44:26 +0200 |
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2018-05-07 12:44:26 +0200 |
| commit | 9f26376281035fde5bf332a4326fadcdb48b7ef7 (patch) | |
| tree | 5f19cca1a9f52c2e00d4007b48fbc25471df194b /src/liballoc | |
| parent | 9b97705f9edb9aef64f417952c02b01dbf16bcea (diff) | |
| download | rust-9f26376281035fde5bf332a4326fadcdb48b7ef7.tar.gz rust-9f26376281035fde5bf332a4326fadcdb48b7ef7.zip | |
Rename Pin to PinMut
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
Diffstat (limited to 'src/liballoc')
| -rw-r--r-- | src/liballoc/boxed.rs | 6 |
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. |
