]> git.lizzy.rs Git - rust.git/blob - src/test/ui/async-await/conditional-and-guaranteed-initialization.rs
Rollup merge of #102215 - alexcrichton:wasm-link-whole-archive, r=estebank
[rust.git] / src / test / ui / async-await / conditional-and-guaranteed-initialization.rs
1 // check-pass
2 // edition:2018
3 // compile-flags: --crate-type lib
4
5 async fn conditional_and_guaranteed_initialization(x: usize) -> usize {
6     let y;
7     if x > 5 {
8         y = echo(10).await;
9     } else {
10         y = get_something().await;
11     }
12     y
13 }
14
15 async fn echo(x: usize) -> usize { x }
16 async fn get_something() -> usize { 10 }