@@ -108,9 +108,26 @@ mod impls {
108108}
109109
110110mod internal_implementation_detail {
111- // TODO: needs a detailed explanation
111+ /// A helper trait that is used to enforce that the `ClosureKind` of a goal
112+ /// is within the capabilities of a `CoroutineClosure`, and which allows us
113+ /// to delay the projection of the tupled upvar types until after upvar
114+ /// analysis is complete.
115+ ///
116+ /// The `Self` type is expected to be the `kind_ty` of the coroutine-closure,
117+ /// and thus either `?0` or `i8`/`i16`/`i32` (see docs for `ClosureKind`
118+ /// for an explanation of that). The `GoalKind` is also the same type, but
119+ /// representing the kind of the trait that the closure is being called with.
112120 #[ cfg_attr( not( bootstrap) , lang = "async_fn_kind_helper" ) ]
113121 trait AsyncFnKindHelper < GoalKind > {
114- type Assoc < ' closure_env , Inputs , Upvars , BorrowedUpvarsAsFnPtr > ;
122+ // Projects a set of closure inputs (arguments), a region, and a set of upvars
123+ // (by move and by ref) to the upvars that we expect the coroutine to have
124+ // according to the `GoalKind` parameter above.
125+ //
126+ // The `Upvars` parameter should be the upvars of the parent coroutine-closure,
127+ // and the `BorrowedUpvarsAsFnPtr` will be a function pointer that has the shape
128+ // `for<'env> fn() -> (&'env T, ...)`. This allows us to represent the binder
129+ // of the closure's self-capture, and these upvar types will be instantiated with
130+ // the `'closure_env` region provided to the associated type.
131+ type Upvars < ' closure_env , Inputs , Upvars , BorrowedUpvarsAsFnPtr > ;
115132 }
116133}
0 commit comments