Skip to content

Commit 323f079

Browse files
test derived from #74961
1 parent 7f5721c commit 323f079

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// check-pass
2+
// edition:2018
3+
4+
// This test is derived from
5+
// https://github.com/rust-lang/rust/issues/74961#issuecomment-666893845
6+
// by @SNCPlay42
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, `&'_ A` should be included in type signature
12+
// of the underlying generator.
13+
14+
#[derive(PartialEq, Eq)]
15+
struct A;
16+
17+
async fn f() -> A {
18+
A
19+
}
20+
21+
async fn g() {
22+
let x = A;
23+
match x {
24+
y if f().await == y => {}
25+
_ => {}
26+
}
27+
}
28+
29+
fn main() {}

0 commit comments

Comments
 (0)