summaryrefslogtreecommitdiffstats
path: root/src/test/ui/async-await/conditional-and-guaranteed-initialization.rs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/test/ui/async-await/conditional-and-guaranteed-initialization.rs16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/test/ui/async-await/conditional-and-guaranteed-initialization.rs b/src/test/ui/async-await/conditional-and-guaranteed-initialization.rs
new file mode 100644
index 000000000..56f4cbbd1
--- /dev/null
+++ b/src/test/ui/async-await/conditional-and-guaranteed-initialization.rs
@@ -0,0 +1,16 @@
+// 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 }