1
Fork 0

addressed nits

This commit is contained in:
tinaun 2018-06-08 23:16:51 -04:00
parent 6e5c18e8dc
commit 49eb754cc0
2 changed files with 3 additions and 24 deletions

View file

@ -932,27 +932,6 @@ impl<'a, F: ?Sized + Future> Future for PinBox<F> {
} }
} }
#[unstable(feature = "futures_api", issue = "50547")]
unsafe impl<F: Future<Output = ()> + Send + 'static> UnsafePoll for Box<F> {
fn into_raw(self) -> *mut () {
unsafe {
mem::transmute(self)
}
}
unsafe fn poll(task: *mut (), cx: &mut Context) -> Poll<()> {
let ptr: *mut F = mem::transmute(task);
let pin: PinMut<F> = PinMut::new_unchecked(&mut *ptr);
pin.poll(cx)
}
unsafe fn drop(task: *mut ()) {
let ptr: *mut F = mem::transmute(task);
let boxed = Box::from_raw(ptr);
drop(boxed)
}
}
#[unstable(feature = "futures_api", issue = "50547")] #[unstable(feature = "futures_api", issue = "50547")]
unsafe impl<F: Future<Output = ()> + Send + 'static> UnsafePoll for PinBox<F> { unsafe impl<F: Future<Output = ()> + Send + 'static> UnsafePoll for PinBox<F> {
fn into_raw(self) -> *mut () { fn into_raw(self) -> *mut () {

View file

@ -326,9 +326,9 @@ impl<'a, F: Future> Future for AssertUnwindSafe<F> {
unsafe { unsafe {
let pinned_field = PinMut::new_unchecked( let pinned_field = PinMut::new_unchecked(
&mut PinMut::get_mut(self.reborrow()).0 &mut PinMut::get_mut(self.reborrow()).0
); );
pinned_field.poll(cx) pinned_field.poll(cx)
} }
} }
} }