@@ -10,15 +10,9 @@ use crate::marker::Tuple;
10
10
#[ must_use = "async closures are lazy and do nothing unless called" ]
11
11
#[ lang = "async_fn" ]
12
12
pub trait AsyncFn < Args : Tuple > : AsyncFnMut < Args > {
13
- /// Future returned by [`AsyncFn::async_call`].
14
- #[ unstable( feature = "async_fn_traits" , issue = "none" ) ]
15
- type CallFuture < ' a > : Future < Output = Self :: Output >
16
- where
17
- Self : ' a ;
18
-
19
13
/// Call the [`AsyncFn`], returning a future which may borrow from the called closure.
20
14
#[ unstable( feature = "async_fn_traits" , issue = "none" ) ]
21
- extern "rust-call" fn async_call ( & self , args : Args ) -> Self :: CallFuture < ' _ > ;
15
+ extern "rust-call" fn async_call ( & self , args : Args ) -> Self :: CallRefFuture < ' _ > ;
22
16
}
23
17
24
18
/// An async-aware version of the [`FnMut`](crate::ops::FnMut) trait.
@@ -30,15 +24,15 @@ pub trait AsyncFn<Args: Tuple>: AsyncFnMut<Args> {
30
24
#[ must_use = "async closures are lazy and do nothing unless called" ]
31
25
#[ lang = "async_fn_mut" ]
32
26
pub trait AsyncFnMut < Args : Tuple > : AsyncFnOnce < Args > {
33
- /// Future returned by [`AsyncFnMut::async_call_mut`].
27
+ /// Future returned by [`AsyncFnMut::async_call_mut`] and [`AsyncFn::async_call`] .
34
28
#[ unstable( feature = "async_fn_traits" , issue = "none" ) ]
35
- type CallMutFuture < ' a > : Future < Output = Self :: Output >
29
+ type CallRefFuture < ' a > : Future < Output = Self :: Output >
36
30
where
37
31
Self : ' a ;
38
32
39
33
/// Call the [`AsyncFnMut`], returning a future which may borrow from the called closure.
40
34
#[ unstable( feature = "async_fn_traits" , issue = "none" ) ]
41
- extern "rust-call" fn async_call_mut ( & mut self , args : Args ) -> Self :: CallMutFuture < ' _ > ;
35
+ extern "rust-call" fn async_call_mut ( & mut self , args : Args ) -> Self :: CallRefFuture < ' _ > ;
42
36
}
43
37
44
38
/// An async-aware version of the [`FnOnce`](crate::ops::FnOnce) trait.
@@ -72,9 +66,7 @@ mod impls {
72
66
where
73
67
F : AsyncFn < A > ,
74
68
{
75
- type CallFuture < ' a > = F :: CallFuture < ' a > where Self : ' a ;
76
-
77
- extern "rust-call" fn async_call ( & self , args : A ) -> Self :: CallFuture < ' _ > {
69
+ extern "rust-call" fn async_call ( & self , args : A ) -> Self :: CallRefFuture < ' _ > {
78
70
F :: async_call ( * self , args)
79
71
}
80
72
}
@@ -84,9 +76,9 @@ mod impls {
84
76
where
85
77
F : AsyncFn < A > ,
86
78
{
87
- type CallMutFuture < ' a > = F :: CallFuture < ' a > where Self : ' a ;
79
+ type CallRefFuture < ' a > = F :: CallRefFuture < ' a > where Self : ' a ;
88
80
89
- extern "rust-call" fn async_call_mut ( & mut self , args : A ) -> Self :: CallMutFuture < ' _ > {
81
+ extern "rust-call" fn async_call_mut ( & mut self , args : A ) -> Self :: CallRefFuture < ' _ > {
90
82
F :: async_call ( * self , args)
91
83
}
92
84
}
@@ -97,7 +89,7 @@ mod impls {
97
89
F : AsyncFn < A > ,
98
90
{
99
91
type Output = F :: Output ;
100
- type CallOnceFuture = F :: CallFuture < ' a > ;
92
+ type CallOnceFuture = F :: CallRefFuture < ' a > ;
101
93
102
94
extern "rust-call" fn async_call_once ( self , args : A ) -> Self :: CallOnceFuture {
103
95
F :: async_call ( self , args)
@@ -109,9 +101,9 @@ mod impls {
109
101
where
110
102
F : AsyncFnMut < A > ,
111
103
{
112
- type CallMutFuture < ' a > = F :: CallMutFuture < ' a > where Self : ' a ;
104
+ type CallRefFuture < ' a > = F :: CallRefFuture < ' a > where Self : ' a ;
113
105
114
- extern "rust-call" fn async_call_mut ( & mut self , args : A ) -> Self :: CallMutFuture < ' _ > {
106
+ extern "rust-call" fn async_call_mut ( & mut self , args : A ) -> Self :: CallRefFuture < ' _ > {
115
107
F :: async_call_mut ( * self , args)
116
108
}
117
109
}
@@ -122,7 +114,7 @@ mod impls {
122
114
F : AsyncFnMut < A > ,
123
115
{
124
116
type Output = F :: Output ;
125
- type CallOnceFuture = F :: CallMutFuture < ' a > ;
117
+ type CallOnceFuture = F :: CallRefFuture < ' a > ;
126
118
127
119
extern "rust-call" fn async_call_once ( self , args : A ) -> Self :: CallOnceFuture {
128
120
F :: async_call_mut ( self , args)
0 commit comments