switch the test to an actual MCVE
This commit is contained in:
parent
66345d9359
commit
df127b86cb
1 changed files with 9 additions and 14 deletions
|
@ -2,28 +2,23 @@
|
||||||
// edition:2018
|
// edition:2018
|
||||||
|
|
||||||
// This test is derived from
|
// This test is derived from
|
||||||
// https://github.com/rust-lang/rust/issues/74961#issuecomment-666893845
|
// https://github.com/rust-lang/rust/issues/72651#issuecomment-668720468
|
||||||
// by @SNCPlay42
|
|
||||||
|
|
||||||
// This test demonstrates that, in `async fn g()`,
|
// This test demonstrates that, in `async fn g()`,
|
||||||
// indeed a temporary borrow `y` from `x` is live
|
// indeed a temporary borrow `y` from `x` is live
|
||||||
// while `f().await` is being evaluated.
|
// 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.
|
// of the underlying generator.
|
||||||
|
|
||||||
#[derive(PartialEq, Eq)]
|
async fn f() -> u8 { 1 }
|
||||||
struct A;
|
|
||||||
|
|
||||||
async fn f() -> A {
|
pub async fn g(x: u8) {
|
||||||
A
|
|
||||||
}
|
|
||||||
|
|
||||||
async fn g() {
|
|
||||||
let x = A;
|
|
||||||
match x {
|
match x {
|
||||||
y if f().await == y => {}
|
y if f().await == y => (),
|
||||||
_ => {}
|
_ => (),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {}
|
fn main() {
|
||||||
|
let _ = g(10);
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue