attempt to work around Box<T> not being recognized as local type

This commit is contained in:
Niv Kaminer 2018-08-10 10:10:35 +03:00
parent 30bb4af5d8
commit c4ec0cd369
2 changed files with 8 additions and 7 deletions

View file

@ -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<Output = ()> + 'a> From<Box<F>> for LocalFutureObj<'a, ()> {
LocalFutureObj::new(boxed)
}
}
#[unstable(feature = "pin", issue = "49150")]
impl<T: Unpin + ?Sized> From<PinBox<T>> for Box<T> {
fn from(pinned: PinBox<T>) -> Box<T> {
unsafe { PinBox::unpin(pinned) }
}
}

View file

@ -133,13 +133,6 @@ impl<T: ?Sized> From<Box<T>> for PinBox<T> {
}
}
#[unstable(feature = "pin", issue = "49150")]
impl<T: Unpin + ?Sized> From<PinBox<T>> for Box<T> {
fn from(pinned: PinBox<T>) -> Box<T> {
pinned.inner
}
}
#[unstable(feature = "pin", issue = "49150")]
impl<T: ?Sized> Deref for PinBox<T> {
type Target = T;