Skip to content

Commit c4ec0cd

Browse files
committed
attempt to work around Box<T> not being recognized as local type
1 parent 30bb4af commit c4ec0cd

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

src/liballoc/boxed.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ use core::ptr::{self, NonNull, Unique};
7171
use core::task::{Context, Poll, Spawn, SpawnErrorKind, SpawnObjError};
7272

7373
use raw_vec::RawVec;
74+
use pin::PinBox;
7475
use str::from_boxed_utf8_unchecked;
7576

7677
/// A pointer type for heap allocation.
@@ -816,3 +817,10 @@ impl<'a, F: Future<Output = ()> + 'a> From<Box<F>> for LocalFutureObj<'a, ()> {
816817
LocalFutureObj::new(boxed)
817818
}
818819
}
820+
821+
#[unstable(feature = "pin", issue = "49150")]
822+
impl<T: Unpin + ?Sized> From<PinBox<T>> for Box<T> {
823+
fn from(pinned: PinBox<T>) -> Box<T> {
824+
unsafe { PinBox::unpin(pinned) }
825+
}
826+
}

src/liballoc/pin.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -133,13 +133,6 @@ impl<T: ?Sized> From<Box<T>> for PinBox<T> {
133133
}
134134
}
135135

136-
#[unstable(feature = "pin", issue = "49150")]
137-
impl<T: Unpin + ?Sized> From<PinBox<T>> for Box<T> {
138-
fn from(pinned: PinBox<T>) -> Box<T> {
139-
pinned.inner
140-
}
141-
}
142-
143136
#[unstable(feature = "pin", issue = "49150")]
144137
impl<T: ?Sized> Deref for PinBox<T> {
145138
type Target = T;

0 commit comments

Comments
 (0)