mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-04 01:42:54 +03:00
addressed nits
This commit is contained in:
@@ -932,27 +932,6 @@ fn poll(mut self: PinMut<Self>, cx: &mut Context) -> Poll<Self::Output> {
|
||||
}
|
||||
}
|
||||
|
||||
#[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")]
|
||||
unsafe impl<F: Future<Output = ()> + Send + 'static> UnsafePoll for PinBox<F> {
|
||||
fn into_raw(self) -> *mut () {
|
||||
|
||||
+3
-3
@@ -326,9 +326,9 @@ fn poll(mut self: PinMut<Self>, cx: &mut task::Context) -> Poll<Self::Output> {
|
||||
unsafe {
|
||||
let pinned_field = PinMut::new_unchecked(
|
||||
&mut PinMut::get_mut(self.reborrow()).0
|
||||
);
|
||||
|
||||
pinned_field.poll(cx)
|
||||
);
|
||||
|
||||
pinned_field.poll(cx)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user