This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 8 files changed +20
-30
lines changed
tests/ui/async-await/async-closures Expand file tree Collapse file tree 8 files changed +20
-30
lines changed Original file line number Diff line number Diff line change 55// FIXME(async_closures): When `fn_sig_for_fn_abi` is fixed, remove this.
66// ignore-pass (test emits codegen-time warnings)
77
8- #![ feature( async_closure, async_fn_traits ) ]
8+ #![ feature( async_closure) ]
99
1010extern crate block_on;
1111
12- use std:: ops:: AsyncFnMut ;
13-
1412fn main ( ) {
1513 block_on:: block_on ( async {
1614 let x = async || { } ;
1715
18- async fn needs_async_fn_mut ( mut x : impl AsyncFnMut ( ) ) {
16+ async fn needs_async_fn_mut ( mut x : impl async FnMut ( ) ) {
1917 x ( ) . await ;
2018 }
2119 needs_async_fn_mut ( x) . await ;
Original file line number Diff line number Diff line change 55// FIXME(async_closures): When `fn_sig_for_fn_abi` is fixed, remove this.
66// ignore-pass (test emits codegen-time warnings)
77
8- #![ feature( async_closure, async_fn_traits ) ]
8+ #![ feature( async_closure) ]
99
1010extern crate block_on;
1111
12- use std:: ops:: AsyncFnOnce ;
13-
1412fn main ( ) {
1513 block_on:: block_on ( async {
1614 let x = async || { } ;
1715
18- async fn needs_async_fn_once ( x : impl AsyncFnOnce ( ) ) {
16+ async fn needs_async_fn_once ( x : impl async FnOnce ( ) ) {
1917 x ( ) . await ;
2018 }
2119 needs_async_fn_once ( x) . await ;
Original file line number Diff line number Diff line change 11// edition: 2021
22
3- #![ feature( async_closure, noop_waker, async_fn_traits ) ]
3+ #![ feature( async_closure, noop_waker) ]
44
55use std:: future:: Future ;
66use std:: pin:: pin;
Original file line number Diff line number Diff line change 22// edition:2021
33// build-pass
44
5- #![ feature( async_closure, async_fn_traits ) ]
5+ #![ feature( async_closure) ]
66
77extern crate block_on;
88
99use std:: future:: Future ;
1010use std:: marker:: PhantomData ;
11- use std:: ops:: AsyncFn ;
1211
1312struct S ;
1413struct B < ' b > ( PhantomData < & ' b mut & ' b mut ( ) > ) ;
1514
1615impl S {
17- async fn q < F : AsyncFn ( B < ' _ > ) > ( self , f : F ) {
16+ async fn q < F : async Fn ( B < ' _ > ) > ( self , f : F ) {
1817 f ( B ( PhantomData ) ) . await ;
1918 }
2019}
Original file line number Diff line number Diff line change 33// run-pass
44// check-run-results
55
6- #![ feature( async_closure, async_fn_traits ) ]
6+ #![ feature( async_closure) ]
77#![ allow( unused) ]
88
99extern crate block_on;
1010
11- use std:: ops:: AsyncFnOnce ;
12-
1311struct DropMe ( i32 ) ;
1412
1513impl Drop for DropMe {
@@ -18,7 +16,7 @@ impl Drop for DropMe {
1816 }
1917}
2018
21- async fn call_once ( f : impl AsyncFnOnce ( ) ) {
19+ async fn call_once ( f : impl async FnOnce ( ) ) {
2220 println ! ( "before call" ) ;
2321 let fut = Box :: pin ( f ( ) ) ;
2422 println ! ( "after call" ) ;
Original file line number Diff line number Diff line change 88// FIXME(async_closures): When `fn_sig_for_fn_abi` is fixed, remove this.
99// ignore-pass (test emits codegen-time warnings)
1010
11- #![ feature( async_closure, noop_waker, async_fn_traits ) ]
11+ #![ feature( async_closure, noop_waker) ]
1212
1313extern crate block_on;
1414
1515use std:: future:: Future ;
16- use std:: ops:: { AsyncFnMut , AsyncFnOnce } ;
1716use std:: pin:: pin;
1817use std:: task:: * ;
1918
20- async fn call_mut ( f : & mut impl AsyncFnMut ( ) ) {
19+ async fn call_mut ( f : & mut impl async FnMut ( ) ) {
2120 f ( ) . await ;
2221}
2322
24- async fn call_once ( f : impl AsyncFnOnce ( ) ) {
23+ async fn call_once ( f : impl async FnOnce ( ) ) {
2524 f ( ) . await ;
2625}
2726
Original file line number Diff line number Diff line change 22
33// FIXME(async_closures): This needs a better error message!
44
5- #![ feature( async_closure, async_fn_traits) ]
6-
7- use std:: ops:: AsyncFn ;
5+ #![ feature( async_closure) ]
86
97fn main ( ) {
10- fn needs_async_fn ( _: impl AsyncFn ( ) ) { }
8+ fn needs_async_fn ( _: impl async Fn ( ) ) { }
119
1210 let mut x = 1 ;
1311 needs_async_fn ( async || {
1412 //~^ 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.
1614 x += 1 ;
1715 } ) ;
1816}
Original file line number Diff line number Diff line change 11error[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
33 |
44LL | needs_async_fn(async || {
55 | _____--------------_^
66 | | |
77 | | required by a bound introduced by this call
88LL | |
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.
1010LL | | x += 1;
1111LL | | });
1212 | |_____^ the trait `ops::async_function::internal_implementation_detail::AsyncFnKindHelper<i8>` is not implemented for `i16`
1313 |
1414note: required by a bound in `needs_async_fn`
15- --> $DIR/wrong-fn-kind.rs:10 :31
15+ --> $DIR/wrong-fn-kind.rs:8 :31
1616 |
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`
1919
2020error: aborting due to 1 previous error
2121
You can’t perform that action at this time.
0 commit comments