Add drop tracking version of yielding-in-match-guard.rs

This commit is contained in:
Eric Holk 2022-05-10 17:58:18 -07:00
parent c067287049
commit ab8c50f964

View File

@ -0,0 +1,25 @@
// build-pass
// edition:2018
// compile-flags: -Zdrop-tracking
// This test is derived from
// 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, `&'_ u8` should be included in type signature
// of the underlying generator.
async fn f() -> u8 { 1 }
async fn i(x: u8) {
match x {
y if f().await == y + 1 => (),
_ => (),
}
}
fn main() {
let _ = i(8);
}