diff options
| author | Michael Goulet <michael@errs.io> | 2024-01-25 17:43:35 +0000 |
|---|---|---|
| committer | Michael Goulet <michael@errs.io> | 2024-02-06 02:22:58 +0000 |
| commit | 37184e86ea58bc90b8cd97f877d52ccce8ea02ab (patch) | |
| tree | ccdae57eb3b8210c03d14b8e6e7a558c429a63bf /tests/ui/async-await/async-closures/mutate.rs | |
| parent | 881b6b5149e882434a8df80a829bcfde0a2e9d37 (diff) | |
| download | rust-37184e86ea58bc90b8cd97f877d52ccce8ea02ab.tar.gz rust-37184e86ea58bc90b8cd97f877d52ccce8ea02ab.zip | |
Add some tests
Diffstat (limited to 'tests/ui/async-await/async-closures/mutate.rs')
| -rw-r--r-- | tests/ui/async-await/async-closures/mutate.rs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/ui/async-await/async-closures/mutate.rs b/tests/ui/async-await/async-closures/mutate.rs new file mode 100644 index 00000000000..cc1df5f034f --- /dev/null +++ b/tests/ui/async-await/async-closures/mutate.rs @@ -0,0 +1,19 @@ +// aux-build:block-on.rs +// edition:2021 +// run-pass + +#![feature(async_closure)] + +extern crate block_on; + +fn main() { + block_on::block_on(async { + let mut prefix = String::from("Hello"); + let mut c = async move |x: &str| { + prefix.push(','); + println!("{prefix} {x}!") + }; + c("world").await; + c("rust").await; + }); +} |
