-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-async-awaitArea: Async & AwaitArea: Async & AwaitAsyncAwait-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.
Description
The following code, when switching between lines 14 and 15 (the two versions of the for
line), oscillates between compiling and not compiling because it requires Sync
for the dyn Send
items:
#![feature(async_await, await_macro, futures_api)]
use std::collections::VecDeque;
use std::future::Future;
pub async fn receive<HandleFn, Fut, Ret>(handle: HandleFn) -> Ret
where
Fut: Future<Output = ()>,
HandleFn: Fn() -> Fut,
{
let v: VecDeque<Box<dyn Send>> = VecDeque::new();
let l = v.len();
for _i in 0..v.len() {
//for _i in 0..l {
await!(handle());
}
loop {}
}
fn do_stuff<F: Future + Send>(_f: F) {}
pub fn showcase() {
do_stuff(async {
match await!(receive(async move || ())) {
true => "test",
false => "test",
};
});
}
(Note: this is a simplification of the failure that occurs on Ekleog/erlust@98c6cbc when running cargo test
)
Metadata
Metadata
Assignees
Labels
A-async-awaitArea: Async & AwaitArea: Async & AwaitAsyncAwait-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.