]>
git.proxmox.com Git - rustc.git/blob - src/test/ui/generator/yielding-in-match-guards.rs
4 // This test is derived from
5 // https://github.com/rust-lang/rust/issues/72651#issuecomment-668720468
7 // This test demonstrates that, in `async fn g()`,
8 // indeed a temporary borrow `y` from `x` is live
9 // while `f().await` is being evaluated.
10 // Thus, `&'_ u8` should be included in type signature
11 // of the underlying generator.
13 async
fn f() -> u8 { 1 }
14 async
fn foo() -> [bool
; 10] { [false; 10] }
16 pub async
fn g(x
: u8) {
18 y
if f().await
== y
=> (),
23 // #78366: check the reference to the binding is recorded even if the binding is not autorefed
25 async
fn h(x
: usize) {
27 y
if foo().await
[y
] => (),
34 y
if f().await
== y
+ 1 => (),