]> git.lizzy.rs Git - rust.git/blob - src/test/ui/async-await/issues/issue-69307-nested.rs
Rollup merge of #103766 - lukas-code:error-in-core, r=Dylan-DPC
[rust.git] / src / test / ui / async-await / issues / issue-69307-nested.rs
1 // Regression test for #69307
2 //
3 // Having a `async { .. foo.await .. }` block appear inside of a `+=`
4 // expression was causing an ICE due to a failure to save/restore
5 // state in the AST numbering pass when entering a nested body.
6 //
7 // check-pass
8 // edition:2018
9
10 fn block_on<F>(_: F) -> usize {
11     0
12 }
13
14 fn main() {}
15
16 async fn bar() {
17     let mut sum = 0;
18     sum += {
19         block_on(async {
20             baz().await;
21             let mut inner = 1;
22             inner += block_on(async {
23                 baz().await;
24                 0
25             })
26         })
27     };
28 }
29
30 async fn baz() {}