-
Notifications
You must be signed in to change notification settings - Fork 13.7k
Closed
Labels
A-async-awaitArea: Async & AwaitArea: Async & AwaitA-inferenceArea: Type inferenceArea: Type inferenceA-type-systemArea: Type systemArea: Type systemAsyncAwait-PolishAsync-await issues that are part of the "polish" areaAsync-await issues that are part of the "polish" areaT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
MRE:
futures-preview = =0.3.0-alpha.13
rustc -vV = 1.34.0-nightly (146aa60f3 2019-02-18) x86_64-unknown-linux-gnu LLVM 8.0
use futures::stream::Stream;
use core::pin::Pin;
pub async fn next<St>(stream: &mut St) -> Option<St::Item>
where St: Stream + Unpin,
{
use futures::future::poll_fn;
let poll_next = |waker| Pin::new(&mut *stream).poll_next(waker);
let future_next = poll_fn(poll_next);
await!(future_next)
}
error[E0308]: mismatched types
--> src/stream.rs:11:5
|
11 | await!(future_next)
| ^^^^^^^^^^^^^^^^^^^ one type is more general than the other
|
= note: expected type `for<'r> std::ops::FnMut<(&'r std::task::Waker,)>`
found type `std::ops::FnMut<(&std::task::Waker,)>`
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
error: aborting due to previous error
For more information about this error, try `rustc --explain E0308`.
Local fix:
- let poll_next = |waker| Pin::new(&mut *stream).poll_next(waker);
+ let poll_next = |waker: &_| Pin::new(&mut *stream).poll_next(waker);
Is it a bug?
Metadata
Metadata
Assignees
Labels
A-async-awaitArea: Async & AwaitArea: Async & AwaitA-inferenceArea: Type inferenceArea: Type inferenceA-type-systemArea: Type systemArea: Type systemAsyncAwait-PolishAsync-await issues that are part of the "polish" areaAsync-await issues that are part of the "polish" areaT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.