-
Notifications
You must be signed in to change notification settings - Fork 14k
Open
Labels
A-async-awaitArea: Async & AwaitArea: Async & AwaitA-coroutinesArea: CoroutinesArea: CoroutinesAsyncAwait-TriagedAsync-await issues that have been triaged during a working group meeting.Async-await issues that have been triaged during a working group meeting.T-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.T-typesRelevant to the types team, which will review and decide on the PR/issue.Relevant to the types team, which will review and decide on the PR/issue.
Description
Another instance of #110338 (pretty similar to #71723 I guess). Code sample:
pub fn serve() -> impl Future<Output = ()> + Send {
async move {
let netstack = Foo;
let stream = futures::stream::iter(vec![]);
let work_items_fut =
// async move {
stream.for_each(|()| async {
let _ns = netstack.clone();
})
// .await }
;
let mut _fut0 = MaybeDone::Future(work_items_fut);
let mut _fut0 = unsafe { core::pin::Pin::new_unchecked(&mut _fut0) };
_fut0.await
}
}error: implementation of `std::marker::Send` is not general enough
--> src/lib.rs:24:5
|
24 | / async move {
25 | | let netstack = Foo;
26 | | let stream = futures::stream::iter(vec![]);
27 | | let work_items_fut =
... |
38 | | _fut0.await
39 | | }
| |_____^ implementation of `std::marker::Send` is not general enough
|
= note: `std::marker::Send` would have to be implemented for the type `&'0 Foo`, for any lifetime `'0`...
= note: ...but `std::marker::Send` is actually implemented for the type `&'1 Foo`, for some specific lifetime `'1`
error[[E0308]](https://doc.rust-lang.org/stable/error_codes/E0308.html): mismatched types
--> src/lib.rs:24:5
|
24 | / async move {
25 | | let netstack = Foo;
26 | | let stream = futures::stream::iter(vec![]);
27 | | let work_items_fut =
... |
38 | | _fut0.await
39 | | }
| |_____^ one type is more general than the other
|
= note: expected `async` block `[async block@src/lib.rs:29:38: 31:18]`
found `async` block `[async block@src/lib.rs:29:38: 31:18]`
For more information about this error, try `rustc --explain E0308`.
error: could not compile `playground` due to 2 previous errors
What's interesting about this one to me is that uncommenting the commented lines (wrapping in an async move) removes the error.
The projection type being in MaybeDone is load-bearing, so I suspect something like #92449 would have fixed this.
Metadata
Metadata
Assignees
Labels
A-async-awaitArea: Async & AwaitArea: Async & AwaitA-coroutinesArea: CoroutinesArea: CoroutinesAsyncAwait-TriagedAsync-await issues that have been triaged during a working group meeting.Async-await issues that have been triaged during a working group meeting.T-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.T-typesRelevant to the types team, which will review and decide on the PR/issue.Relevant to the types team, which will review and decide on the PR/issue.