summary refs log tree commit diff
path: root/src/test/ui/async-await/conditional-and-guaranteed-initialization.rs
blob: a5947e7f7187025d926a876b36937b1525bd5bd7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// check-pass
// edition:2018
// compile-flags: --crate-type lib

#![feature(async_await)]

async fn conditional_and_guaranteed_initialization(x: usize) -> usize {
    let y;
    if x > 5 {
        y = echo(10).await;
    } else {
        y = get_something().await;
    }
    y
}

async fn echo(x: usize) -> usize { x }
async fn get_something() -> usize { 10 }