We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7f5721c commit 323f079Copy full SHA for 323f079
src/test/ui/generator/yielding-in-match-guards.rs
@@ -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