Skip to content

Commit df127b8

Browse files
switch the test to an actual MCVE
1 parent 66345d9 commit df127b8

File tree

1 file changed

+9
-14
lines changed

1 file changed

+9
-14
lines changed

src/test/ui/generator/yielding-in-match-guards.rs

+9-14
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,23 @@
22
// edition:2018
33

44
// This test is derived from
5-
// https://github.com/rust-lang/rust/issues/74961#issuecomment-666893845
6-
// by @SNCPlay42
5+
// https://github.com/rust-lang/rust/issues/72651#issuecomment-668720468
76

87
// This test demonstrates that, in `async fn g()`,
98
// indeed a temporary borrow `y` from `x` is live
109
// while `f().await` is being evaluated.
11-
// Thus, `&'_ A` should be included in type signature
10+
// Thus, `&'_ u8` should be included in type signature
1211
// of the underlying generator.
1312

14-
#[derive(PartialEq, Eq)]
15-
struct A;
13+
async fn f() -> u8 { 1 }
1614

17-
async fn f() -> A {
18-
A
19-
}
20-
21-
async fn g() {
22-
let x = A;
15+
pub async fn g(x: u8) {
2316
match x {
24-
y if f().await == y => {}
25-
_ => {}
17+
y if f().await == y => (),
18+
_ => (),
2619
}
2720
}
2821

29-
fn main() {}
22+
fn main() {
23+
let _ = g(10);
24+
}

0 commit comments

Comments
 (0)