diff --git a/compiler/rustc_type_ir/src/ty_kind.rs b/compiler/rustc_type_ir/src/ty_kind.rs index d067fc7f5677f..188aa20107c56 100644 --- a/compiler/rustc_type_ir/src/ty_kind.rs +++ b/compiler/rustc_type_ir/src/ty_kind.rs @@ -275,17 +275,23 @@ pub enum TyKind { /// `CoroutineArgs`. Coroutine(I::CoroutineId, I::GenericArgs), - /// A type representing the types stored inside a coroutine. + /// A type representing the types of coroutine's MIR local variables + /// that live across suspend points. /// - /// This should only appear as part of the `CoroutineArgs`. + /// The coroutine witness type is not a data type and won't be stored in memory at runtime. + /// It's used in trait solving. + /// + /// It doesn't consider coroutine upvar types. /// /// Unlike upvars, the witness can reference lifetimes from /// inside of the coroutine itself. To deal with them in /// the type of the coroutine, we convert them to higher ranked /// lifetimes bound by the witness itself. /// - /// This contains the `DefId` and the `GenericArg` of the coroutine. + /// This contains the `DefId` and the `GenericArg` of the coroutine + /// (but with lifetimes erased, in `new_coroutine_witness_for_coroutine`). /// The actual witness types are computed on MIR by the `mir_coroutine_witnesses` query. + /// In auto trait solving, its constituent types come from `coroutine_hidden_types` query. /// /// Looking at the following example, the witness for this coroutine /// may end up as something like `for<'a> [Vec, &'a Vec]`: