diff options
Diffstat (limited to '')
-rw-r--r-- | src/test/ui/async-await/no-non-guaranteed-initialization.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/test/ui/async-await/no-non-guaranteed-initialization.rs b/src/test/ui/async-await/no-non-guaranteed-initialization.rs new file mode 100644 index 000000000..c4d81bf83 --- /dev/null +++ b/src/test/ui/async-await/no-non-guaranteed-initialization.rs @@ -0,0 +1,12 @@ +// 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 //~ ERROR E0381 +} + +async fn echo(x: usize) -> usize { x + 1 } |