File tree 8 files changed +20
-30
lines changed
tests/ui/async-await/async-closures
8 files changed +20
-30
lines changed Original file line number Diff line number Diff line change 5
5
// FIXME(async_closures): When `fn_sig_for_fn_abi` is fixed, remove this.
6
6
// ignore-pass (test emits codegen-time warnings)
7
7
8
- #![ feature( async_closure, async_fn_traits ) ]
8
+ #![ feature( async_closure) ]
9
9
10
10
extern crate block_on;
11
11
12
- use std:: ops:: AsyncFnMut ;
13
-
14
12
fn main ( ) {
15
13
block_on:: block_on ( async {
16
14
let x = async || { } ;
17
15
18
- async fn needs_async_fn_mut ( mut x : impl AsyncFnMut ( ) ) {
16
+ async fn needs_async_fn_mut ( mut x : impl async FnMut ( ) ) {
19
17
x ( ) . await ;
20
18
}
21
19
needs_async_fn_mut ( x) . await ;
Original file line number Diff line number Diff line change 5
5
// FIXME(async_closures): When `fn_sig_for_fn_abi` is fixed, remove this.
6
6
// ignore-pass (test emits codegen-time warnings)
7
7
8
- #![ feature( async_closure, async_fn_traits ) ]
8
+ #![ feature( async_closure) ]
9
9
10
10
extern crate block_on;
11
11
12
- use std:: ops:: AsyncFnOnce ;
13
-
14
12
fn main ( ) {
15
13
block_on:: block_on ( async {
16
14
let x = async || { } ;
17
15
18
- async fn needs_async_fn_once ( x : impl AsyncFnOnce ( ) ) {
16
+ async fn needs_async_fn_once ( x : impl async FnOnce ( ) ) {
19
17
x ( ) . await ;
20
18
}
21
19
needs_async_fn_once ( x) . await ;
Original file line number Diff line number Diff line change 1
1
// edition: 2021
2
2
3
- #![ feature( async_closure, noop_waker, async_fn_traits ) ]
3
+ #![ feature( async_closure, noop_waker) ]
4
4
5
5
use std:: future:: Future ;
6
6
use std:: pin:: pin;
Original file line number Diff line number Diff line change 2
2
// edition:2021
3
3
// build-pass
4
4
5
- #![ feature( async_closure, async_fn_traits ) ]
5
+ #![ feature( async_closure) ]
6
6
7
7
extern crate block_on;
8
8
9
9
use std:: future:: Future ;
10
10
use std:: marker:: PhantomData ;
11
- use std:: ops:: AsyncFn ;
12
11
13
12
struct S ;
14
13
struct B < ' b > ( PhantomData < & ' b mut & ' b mut ( ) > ) ;
15
14
16
15
impl S {
17
- async fn q < F : AsyncFn ( B < ' _ > ) > ( self , f : F ) {
16
+ async fn q < F : async Fn ( B < ' _ > ) > ( self , f : F ) {
18
17
f ( B ( PhantomData ) ) . await ;
19
18
}
20
19
}
Original file line number Diff line number Diff line change 3
3
// run-pass
4
4
// check-run-results
5
5
6
- #![ feature( async_closure, async_fn_traits ) ]
6
+ #![ feature( async_closure) ]
7
7
#![ allow( unused) ]
8
8
9
9
extern crate block_on;
10
10
11
- use std:: ops:: AsyncFnOnce ;
12
-
13
11
struct DropMe ( i32 ) ;
14
12
15
13
impl Drop for DropMe {
@@ -18,7 +16,7 @@ impl Drop for DropMe {
18
16
}
19
17
}
20
18
21
- async fn call_once ( f : impl AsyncFnOnce ( ) ) {
19
+ async fn call_once ( f : impl async FnOnce ( ) ) {
22
20
println ! ( "before call" ) ;
23
21
let fut = Box :: pin ( f ( ) ) ;
24
22
println ! ( "after call" ) ;
Original file line number Diff line number Diff line change 8
8
// FIXME(async_closures): When `fn_sig_for_fn_abi` is fixed, remove this.
9
9
// ignore-pass (test emits codegen-time warnings)
10
10
11
- #![ feature( async_closure, noop_waker, async_fn_traits ) ]
11
+ #![ feature( async_closure, noop_waker) ]
12
12
13
13
extern crate block_on;
14
14
15
15
use std:: future:: Future ;
16
- use std:: ops:: { AsyncFnMut , AsyncFnOnce } ;
17
16
use std:: pin:: pin;
18
17
use std:: task:: * ;
19
18
20
- async fn call_mut ( f : & mut impl AsyncFnMut ( ) ) {
19
+ async fn call_mut ( f : & mut impl async FnMut ( ) ) {
21
20
f ( ) . await ;
22
21
}
23
22
24
- async fn call_once ( f : impl AsyncFnOnce ( ) ) {
23
+ async fn call_once ( f : impl async FnOnce ( ) ) {
25
24
f ( ) . await ;
26
25
}
27
26
Original file line number Diff line number Diff line change 2
2
3
3
// FIXME(async_closures): This needs a better error message!
4
4
5
- #![ feature( async_closure, async_fn_traits) ]
6
-
7
- use std:: ops:: AsyncFn ;
5
+ #![ feature( async_closure) ]
8
6
9
7
fn main ( ) {
10
- fn needs_async_fn ( _: impl AsyncFn ( ) ) { }
8
+ fn needs_async_fn ( _: impl async Fn ( ) ) { }
11
9
12
10
let mut x = 1 ;
13
11
needs_async_fn ( async || {
14
12
//~^ ERROR i16: ops::async_function::internal_implementation_detail::AsyncFnKindHelper<i8>
15
- // FIXME: Should say "closure is AsyncFnMut but it needs AsyncFn " or sth.
13
+ // FIXME: Should say "closure is `async FnMut` but it needs `async Fn` " or sth.
16
14
x += 1 ;
17
15
} ) ;
18
16
}
Original file line number Diff line number Diff line change 1
1
error[E0277]: the trait bound `i16: ops::async_function::internal_implementation_detail::AsyncFnKindHelper<i8>` is not satisfied
2
- --> $DIR/wrong-fn-kind.rs:13 :20
2
+ --> $DIR/wrong-fn-kind.rs:11 :20
3
3
|
4
4
LL | needs_async_fn(async || {
5
5
| _____--------------_^
6
6
| | |
7
7
| | required by a bound introduced by this call
8
8
LL | |
9
- LL | | // FIXME: Should say "closure is AsyncFnMut but it needs AsyncFn " or sth.
9
+ LL | | // FIXME: Should say "closure is `async FnMut` but it needs `async Fn` " or sth.
10
10
LL | | x += 1;
11
11
LL | | });
12
12
| |_____^ the trait `ops::async_function::internal_implementation_detail::AsyncFnKindHelper<i8>` is not implemented for `i16`
13
13
|
14
14
note: required by a bound in `needs_async_fn`
15
- --> $DIR/wrong-fn-kind.rs:10 :31
15
+ --> $DIR/wrong-fn-kind.rs:8 :31
16
16
|
17
- LL | fn needs_async_fn(_: impl AsyncFn ()) {}
18
- | ^^^^^^^^^ required by this bound in `needs_async_fn`
17
+ LL | fn needs_async_fn(_: impl async Fn ()) {}
18
+ | ^^^^^^^^^^ required by this bound in `needs_async_fn`
19
19
20
20
error: aborting due to 1 previous error
21
21
You can’t perform that action at this time.
0 commit comments