diff --git a/src/liballoc/boxed.rs b/src/liballoc/boxed.rs index b5c2fd7526da..c25f3eb8f175 100644 --- a/src/liballoc/boxed.rs +++ b/src/liballoc/boxed.rs @@ -71,6 +71,7 @@ use core::ptr::{self, NonNull, Unique}; use core::task::{Context, Poll, Spawn, SpawnErrorKind, SpawnObjError}; use raw_vec::RawVec; +use pin::PinBox; use str::from_boxed_utf8_unchecked; /// A pointer type for heap allocation. @@ -816,3 +817,10 @@ impl<'a, F: Future + 'a> From> for LocalFutureObj<'a, ()> { LocalFutureObj::new(boxed) } } + +#[unstable(feature = "pin", issue = "49150")] +impl From> for Box { + fn from(pinned: PinBox) -> Box { + unsafe { PinBox::unpin(pinned) } + } +} diff --git a/src/liballoc/pin.rs b/src/liballoc/pin.rs index 1b6ccae456ad..bacc13fa74ac 100644 --- a/src/liballoc/pin.rs +++ b/src/liballoc/pin.rs @@ -133,13 +133,6 @@ impl From> for PinBox { } } -#[unstable(feature = "pin", issue = "49150")] -impl From> for Box { - fn from(pinned: PinBox) -> Box { - pinned.inner - } -} - #[unstable(feature = "pin", issue = "49150")] impl Deref for PinBox { type Target = T;