@@ -20,7 +20,15 @@ use task::{Context, Poll};
20
20
21
21
/// A custom trait object for polling futures, roughly akin to
22
22
/// `Box<dyn Future<Output = T> + 'a>`.
23
- /// Contrary to `FutureObj`, `LocalFutureObj` does not have a `Send` bound.
23
+ ///
24
+ /// This custom trait object was introduced for two reasons:
25
+ /// - Currently it is not possible to take `dyn Trait` by value and
26
+ /// `Box<dyn Trait>` is not available in no_std contexts.
27
+ /// - The `Future` trait is currently not object safe: The `Future::poll`
28
+ /// method makes uses the arbitrary self types feature and traits in which
29
+ /// this feature is used are currently not object safe due to current compiler
30
+ /// limitations. (See tracking issue for arbitray self types for more
31
+ /// information #44874)
24
32
pub struct LocalFutureObj < ' a , T > {
25
33
ptr : * mut ( ) ,
26
34
poll_fn : unsafe fn ( * mut ( ) , & mut Context ) -> Poll < T > ,
@@ -87,6 +95,15 @@ impl<'a, T> Drop for LocalFutureObj<'a, T> {
87
95
88
96
/// A custom trait object for polling futures, roughly akin to
89
97
/// `Box<dyn Future<Output = T> + Send + 'a>`.
98
+ ///
99
+ /// This custom trait object was introduced for two reasons:
100
+ /// - Currently it is not possible to take `dyn Trait` by value and
101
+ /// `Box<dyn Trait>` is not available in no_std contexts.
102
+ /// - The `Future` trait is currently not object safe: The `Future::poll`
103
+ /// method makes uses the arbitrary self types feature and traits in which
104
+ /// this feature is used are currently not object safe due to current compiler
105
+ /// limitations. (See tracking issue for arbitray self types for more
106
+ /// information #44874)
90
107
pub struct FutureObj < ' a , T > ( LocalFutureObj < ' a , T > ) ;
91
108
92
109
unsafe impl < ' a , T > Send for FutureObj < ' a , T > { }
0 commit comments