switch the test to an actual MCVE
This commit is contained in:
parent
66345d9359
commit
df127b86cb
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user