Skip to content
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

Can't poll_unpin MaybeDone in futures 0.3.10 (worked in 0.3.8) #2316

Closed
ComputerDruid opened this issue Jan 14, 2021 · 2 comments · Fixed by #2317
Closed

Can't poll_unpin MaybeDone in futures 0.3.10 (worked in 0.3.8) #2316

ComputerDruid opened this issue Jan 14, 2021 · 2 comments · Fixed by #2317
Assignees
Labels
A-future Area: futures::future bug

Comments

@ComputerDruid
Copy link
Contributor

The following code compiles with futures_util 0.3.8:

https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=7af38519429f4b3e8a8a96cd6f645910

0.3.8 happens to be the version of futures in the playground at the time of writing, so that playground link compiles at the moment. That might change when playground next grabs crates.

But with 0.3.10 and 0.3.11, it fails:

error[E0277]: `T` cannot be unpinned
  --> src/main.rs:43:23
   |
43 |         ready!(self.0.poll_unpin(cx));
   |                       ^^^^^^^^^^ within `futures_util::future::MaybeDone<futures_util::future::AndThen<MessageResponse, futures_util::future::Ready<std::result::Result<T, Error>>, fn(MessageBufEtc) -> futures_util::future::Ready<std::result::Result<T, Error>>>>`, the trait `std::marker::Unpin` is not implemented for `T`
   |
   = note: required because it appears within the type `std::result::Result<T, Error>`
   = note: required because it appears within the type `futures_util::future::MaybeDone<futures_util::future::AndThen<MessageResponse, futures_util::future::Ready<std::result::Result<T, Error>>, fn(MessageBufEtc) -> futures_util::future::Ready<std::result::Result<T, Error>>>>`
help: consider restricting type parameter `T`
   |
39 | impl<T: std::marker::Unpin> Future for QueryResponseFut<T> {
   |       ^^^^^^^^^^^^^^^^^^^^

error[E0277]: `T` cannot be unpinned
  --> src/main.rs:44:35
   |
44 |         let maybe_done = Pin::new(&mut self.0);
   |                                   ^^^^^^^^^^^ within `futures_util::future::MaybeDone<futures_util::future::AndThen<MessageResponse, futures_util::future::Ready<std::result::Result<T, Error>>, fn(MessageBufEtc) -> futures_util::future::Ready<std::result::Result<T, Error>>>>`, the trait `std::marker::Unpin` is not implemented for `T`
   |
   = note: required because it appears within the type `std::result::Result<T, Error>`
   = note: required because it appears within the type `futures_util::future::MaybeDone<futures_util::future::AndThen<MessageResponse, futures_util::future::Ready<std::result::Result<T, Error>>, fn(MessageBufEtc) -> futures_util::future::Ready<std::result::Result<T, Error>>>>`
   = note: required by `std::pin::Pin::<P>::new`
help: consider restricting type parameter `T`
   |
39 | impl<T: std::marker::Unpin> Future for QueryResponseFut<T> {
   |       ^^^^^^^^^^^^^^^^^^^^

I believe I actually first saw this failure in 0.3.9 but that version is yanked now so I haven't tested this exact snippet.

The above code snippet is extracted from the real code in https://cs.opensource.google/fuchsia/fuchsia/+/master:src/lib/fidl/rust/fidl/src/client.rs;l=56;drc=06b9342965f7c226e7a29aa735e19ef2a2a951e6 if that's interesting, but context shouldn't actually be necessary to observe that this is a breaking change.

@taiki-e
Copy link
Member

taiki-e commented Jan 14, 2021

Thanks for the report, and sorry for the breakage! This seems a regression introduced in #2273.

@taiki-e taiki-e self-assigned this Jan 14, 2021
@taiki-e taiki-e added A-future Area: futures::future bug labels Jan 14, 2021
This was referenced Jan 14, 2021
@taiki-e
Copy link
Member

taiki-e commented Jan 15, 2021

Published 0.3.12 which fixes this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-future Area: futures::future bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants