Skip to content

0.2: Fix compilation when "nightly" feature is enabled #1056

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 2, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion futures-async-runtime/src/future.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ impl<T> StableFuture for GenStableFuture<T>
fn poll(self: PinMut<Self>, ctx: &mut task::Context) -> Poll<Self::Item, Self::Error> {
CTX.with(|cell| {
let _r = Reset::new(ctx, cell);
let this: &mut Self = unsafe { PinMut::get_mut(self) };
let this: &mut Self = unsafe { PinMut::get_mut_unchecked(self) };
// This is an immovable generator, but since we're only accessing
// it via a PinMut this is safe.
match unsafe { this.0.resume() } {
Expand Down
2 changes: 1 addition & 1 deletion futures-async-runtime/src/stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ impl<U, T> StableStream for GenStableStream<U, T>
fn poll_next(self: PinMut<Self>, ctx: &mut task::Context) -> Poll<Option<Self::Item>, Self::Error> {
CTX.with(|cell| {
let _r = Reset::new(ctx, cell);
let this: &mut Self = unsafe { PinMut::get_mut(self) };
let this: &mut Self = unsafe { PinMut::get_mut_unchecked(self) };
if this.done { return Ok(Async::Ready(None)) }
// This is an immovable generator, but since we're only accessing
// it via a PinMut this is safe.
Expand Down
2 changes: 1 addition & 1 deletion futures-core/src/future/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ if_std! {
type Error = F::Error;

fn poll(&mut self, cx: &mut task::Context) -> Poll<Self::Item, Self::Error> {
unsafe { ::core::mem::PinMut::get_mut(self.as_pin_mut()).poll(cx) }
unsafe { ::core::mem::PinMut::get_mut_unchecked(self.as_pin_mut()).poll(cx) }
}
}

Expand Down
2 changes: 1 addition & 1 deletion futures-core/src/stream/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ if_std! {
type Error = S::Error;

fn poll_next(&mut self, cx: &mut task::Context) -> Poll<Option<Self::Item>, Self::Error> {
unsafe { ::core::mem::PinMut::get_mut(self.as_pin_mut()).poll_next(cx) }
unsafe { ::core::mem::PinMut::get_mut_unchecked(self.as_pin_mut()).poll_next(cx) }
}
}

Expand Down
4 changes: 2 additions & 2 deletions futures-stable/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ if_nightly! {
type Error = F::Error;

fn poll(self: PinMut<Self>, ctx: &mut task::Context) -> Poll<Self::Item, Self::Error> {
F::poll(unsafe { PinMut::get_mut(self) }, ctx)
F::poll(unsafe { PinMut::get_mut_unchecked(self) }, ctx)
}
}

Expand Down Expand Up @@ -140,7 +140,7 @@ if_nightly! {
type Error = S::Error;

fn poll_next(self: PinMut<Self>, ctx: &mut task::Context) -> Poll<Option<Self::Item>, Self::Error> {
S::poll_next(unsafe { PinMut::get_mut(self) }, ctx)
S::poll_next(unsafe { PinMut::get_mut_unchecked(self) }, ctx)
}
}
}
1 change: 1 addition & 0 deletions futures/tests/async_await/pinned.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use futures::stable::block_on_stable;
use futures::executor::{block_on, ThreadPool};
use futures::prelude::*;
use futures::prelude::await;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ngg Is await not included automatically by the * import above?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without this the compiler gives an error "error[E0659]: await is ambiguous", "note: await could refer to the name imported here" (referring to the prelude), "note: await is also a builtin macro", "note: consider adding an explicit import of await to disambiguate". Explicitly importing it solves this.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, gotcha. Thanks for explaining!


#[async]
fn foo() -> Result<i32, i32> {
Expand Down
1 change: 1 addition & 0 deletions futures/tests/async_await/smoke.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ use std::io;
use futures::Never;
use futures::future::poll_fn;
use futures::prelude::*;
use futures::prelude::await;

#[async]
fn foo() -> Result<i32, i32> {
Expand Down