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
// This test is derived from
// https://github.com/rust-lang/rust/issues/74961#issuecomment-666893845
// by @SNCPlay42
// https://github.com/rust-lang/rust/issues/72651#issuecomment-668720468
// This test demonstrates that, in `async fn g()`,
// indeed a temporary borrow `y` from `x` is live
// 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.
#[derive(PartialEq, Eq)]
struct A;
async fn f() -> u8 { 1 }
async fn f() -> A {
A
}
async fn g() {
let x = A;
pub async fn g(x: u8) {
match x {
y if f().await == y => {}
_ => {}
y if f().await == y => (),
_ => (),
}
}
fn main() {}
fn main() {
let _ = g(10);
}