Closed
Description
Awesome to see async/await starting to light up. I poked around and hit a snag putting together a naive little example. Clearly, this example is probably missing a bit more to get it running, but I just wanted to point the error here doesn't quite help:
#![feature(arbitrary_self_types, async_await, await_macro, futures_api, pin)]
async fn inc(limit: i64) -> i64 {
limit + 1
}
fn main() {
let result = inc(10000);
let finished = await!(result);
}
For the above, you get:
error[E0627]: yield statement outside of generator literal
--> src/main.rs:22:20
|
22 | let finished = await!(result);
| ^^^^^^^^^^^^^^
|
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
Which immediately makes you wonder "what yield statement?" I suspect one of the first things people will want to try is awaiting an async function, so we might want to gently point them in the right direction.