about summary refs log tree commit diff
path: root/src/test/ui/async-await/no-non-guaranteed-initialization.rs
blob: 6a34209d55289b09e9d02a99e622dea7f6bffcba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
// compile-fail
// edition:2018
// compile-flags: --crate-type lib

async fn no_non_guaranteed_initialization(x: usize) -> usize {
    let y;
    if x > 5 {
        y = echo(10).await;
    }
    y
    //~^ use of possibly-uninitialized variable: `y`
}

async fn echo(x: usize) -> usize { x + 1 }