File tree 1 file changed +9
-14
lines changed
1 file changed +9
-14
lines changed Original file line number Diff line number Diff line change 2
2
// edition:2018
3
3
4
4
// This test is derived from
5
- // https://github.com/rust-lang/rust/issues/74961#issuecomment-666893845
6
- // by @SNCPlay42
5
+ // https://github.com/rust-lang/rust/issues/72651#issuecomment-668720468
7
6
8
7
// This test demonstrates that, in `async fn g()`,
9
8
// indeed a temporary borrow `y` from `x` is live
10
9
// while `f().await` is being evaluated.
11
- // Thus, `&'_ A ` should be included in type signature
10
+ // Thus, `&'_ u8 ` should be included in type signature
12
11
// of the underlying generator.
13
12
14
- #[ derive( PartialEq , Eq ) ]
15
- struct A ;
13
+ async fn f ( ) -> u8 { 1 }
16
14
17
- async fn f ( ) -> A {
18
- A
19
- }
20
-
21
- async fn g ( ) {
22
- let x = A ;
15
+ pub async fn g ( x : u8 ) {
23
16
match x {
24
- y if f ( ) . await == y => { }
25
- _ => { }
17
+ y if f ( ) . await == y => ( ) ,
18
+ _ => ( ) ,
26
19
}
27
20
}
28
21
29
- fn main ( ) { }
22
+ fn main ( ) {
23
+ let _ = g ( 10 ) ;
24
+ }
You can’t perform that action at this time.
0 commit comments