From c4ec0cd36927a4a010dc6789bdd88eaa503dadd6 Mon Sep 17 00:00:00 2001 From: Niv Kaminer Date: Fri, 10 Aug 2018 10:10:35 +0300 Subject: attempt to work around Box not being recognized as local type --- src/liballoc/boxed.rs | 8 ++++++++ src/liballoc/pin.rs | 7 ------- 2 files changed, 8 insertions(+), 7 deletions(-) (limited to 'src/liballoc') diff --git a/src/liballoc/boxed.rs b/src/liballoc/boxed.rs index b5c2fd7526d..c25f3eb8f17 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 1b6ccae456a..bacc13fa74a 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; -- cgit 1.4.1-3-g733a5