mirror of
https://github.com/rust-lang/rust.git
synced 2025-05-14 02:49:40 +00:00
Add drop tracking version of yielding-in-match-guard.rs
This commit is contained in:
parent
c067287049
commit
ab8c50f964
@ -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);
|
||||
}
|
Loading…
Reference in New Issue
Block a user