mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-23 23:34:48 +00:00
17 lines
338 B
Rust
17 lines
338 B
Rust
//@ check-pass
|
|
//@ edition:2018
|
|
//@ compile-flags: --crate-type lib
|
|
|
|
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 }
|