diff options
| author | Michael Goulet <michael@errs.io> | 2023-06-23 05:31:14 +0000 |
|---|---|---|
| committer | Michael Goulet <michael@errs.io> | 2023-07-22 15:22:12 +0000 |
| commit | 7b962d754350dd7cc8d2729416cb36a7244b3dd0 (patch) | |
| tree | a3f983a7096035f1930251a97dd41b5d92d3f3f7 /tests/ui/parser | |
| parent | 8164cdb9ee460eddcb8888b9b6f72836a956d110 (diff) | |
| download | rust-7b962d754350dd7cc8d2729416cb36a7244b3dd0.tar.gz rust-7b962d754350dd7cc8d2729416cb36a7244b3dd0.zip | |
Support interpolated block for try and async
Diffstat (limited to 'tests/ui/parser')
| -rw-r--r-- | tests/ui/parser/async-with-nonterminal-block.rs | 16 | ||||
| -rw-r--r-- | tests/ui/parser/try-with-nonterminal-block.rs | 19 |
2 files changed, 35 insertions, 0 deletions
diff --git a/tests/ui/parser/async-with-nonterminal-block.rs b/tests/ui/parser/async-with-nonterminal-block.rs new file mode 100644 index 00000000000..96015fd5d82 --- /dev/null +++ b/tests/ui/parser/async-with-nonterminal-block.rs @@ -0,0 +1,16 @@ +// check-pass +// edition:2021 + +macro_rules! create_async { + ($body:block) => { + async $body + }; +} + +async fn other() {} + +fn main() { + let y = create_async! {{ + other().await; + }}; +} diff --git a/tests/ui/parser/try-with-nonterminal-block.rs b/tests/ui/parser/try-with-nonterminal-block.rs new file mode 100644 index 00000000000..2a9652f2e6d --- /dev/null +++ b/tests/ui/parser/try-with-nonterminal-block.rs @@ -0,0 +1,19 @@ +// check-pass +// edition:2021 + +#![feature(try_blocks)] + +macro_rules! create_try { + ($body:block) => { + try $body + }; +} + +fn main() { + let x: Option<&str> = create_try! {{ + None?; + "Hello world" + }}; + + println!("{x:?}"); +} |
