Curriculum Production Rust Async basics exercise 9 · mcq
Async basics
This line fails to compile because compute is async:
let n = compute(21); // n is impl Future<Output = i32>, not i32
println!("{}", n + 1); // ERROR: Future + i32 doesn't compile
Pick the fix.
About this theme
Rust async is explicit: async fn returns a future, .await yields within an executor, and most real async code is runtime-specific. This theme stays runtime-light and focuses on the mental model. Planned exercises: 1. choose async fn. 2. recognise .await. 3. choose Result in async functions. 4. fill an async call. 5. fill an awaited result. 6. write a small async helper signature. 7. compose two awaited operations. 8. translate TS promise code. 9. fix a future that was created but never awaited.