1
Fork 0

switch the test to an actual MCVE

This commit is contained in:
Ding Xiang Fei 2020-08-19 09:04:40 +08:00
parent 66345d9359
commit df127b86cb
No known key found for this signature in database
GPG key ID: 3CD748647EEF6359

View file

@ -2,28 +2,23 @@
// edition:2018 // edition:2018
// This test is derived from // This test is derived from
// https://github.com/rust-lang/rust/issues/74961#issuecomment-666893845 // https://github.com/rust-lang/rust/issues/72651#issuecomment-668720468
// by @SNCPlay42
// This test demonstrates that, in `async fn g()`, // This test demonstrates that, in `async fn g()`,
// indeed a temporary borrow `y` from `x` is live // indeed a temporary borrow `y` from `x` is live
// while `f().await` is being evaluated. // while `f().await` is being evaluated.
// Thus, `&'_ A` should be included in type signature // Thus, `&'_ u8` should be included in type signature
// of the underlying generator. // of the underlying generator.
#[derive(PartialEq, Eq)] async fn f() -> u8 { 1 }
struct A;
async fn f() -> A { pub async fn g(x: u8) {
A
}
async fn g() {
let x = A;
match x { match x {
y if f().await == y => {} y if f().await == y => (),
_ => {} _ => (),
} }
} }
fn main() {} fn main() {
let _ = g(10);
}