Skip to content

Commit ab8c50f

Browse files
committed
Add drop tracking version of yielding-in-match-guard.rs
1 parent c067287 commit ab8c50f

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// build-pass
2+
// edition:2018
3+
// compile-flags: -Zdrop-tracking
4+
5+
// This test is derived from
6+
// https://github.com/rust-lang/rust/issues/72651#issuecomment-668720468
7+
8+
// This test demonstrates that, in `async fn g()`,
9+
// indeed a temporary borrow `y` from `x` is live
10+
// while `f().await` is being evaluated.
11+
// Thus, `&'_ u8` should be included in type signature
12+
// of the underlying generator.
13+
14+
async fn f() -> u8 { 1 }
15+
16+
async fn i(x: u8) {
17+
match x {
18+
y if f().await == y + 1 => (),
19+
_ => (),
20+
}
21+
}
22+
23+
fn main() {
24+
let _ = i(8);
25+
}

0 commit comments

Comments
 (0)