@@ -101,7 +101,6 @@ use crate::{self as ty, Interner};
101101/// `yield` inside the coroutine.
102102/// * `GR`: The "return type", which is the type of value returned upon
103103/// completion of the coroutine.
104- /// * `GW`: The "coroutine witness".
105104#[ derive_where( Clone , Copy , PartialEq , Eq , Hash , Debug ; I : Interner ) ]
106105#[ derive( TypeVisitable_Generic , TypeFoldable_Generic , Lift_Generic ) ]
107106pub struct ClosureArgs < I : Interner > {
@@ -239,8 +238,6 @@ pub struct CoroutineClosureArgsParts<I: Interner> {
239238 /// while the `tupled_upvars_ty`, representing the by-move version of the same
240239 /// captures, will be `(String,)`.
241240 pub coroutine_captures_by_ref_ty : I :: Ty ,
242- /// Witness type returned by the generator produced by this coroutine-closure.
243- pub coroutine_witness_ty : I :: Ty ,
244241}
245242
246243impl < I : Interner > CoroutineClosureArgs < I > {
@@ -251,7 +248,6 @@ impl<I: Interner> CoroutineClosureArgs<I> {
251248 parts. signature_parts_ty . into ( ) ,
252249 parts. tupled_upvars_ty . into ( ) ,
253250 parts. coroutine_captures_by_ref_ty . into ( ) ,
254- parts. coroutine_witness_ty . into ( ) ,
255251 ] ) ) ,
256252 }
257253 }
@@ -292,7 +288,6 @@ impl<I: Interner> CoroutineClosureArgs<I> {
292288 }
293289
294290 pub fn coroutine_closure_sig ( self ) -> ty:: Binder < I , CoroutineClosureSignature < I > > {
295- let interior = self . coroutine_witness_ty ( ) ;
296291 let ty:: FnPtr ( sig_tys, hdr) = self . signature_parts_ty ( ) . kind ( ) else { panic ! ( ) } ;
297292 sig_tys. map_bound ( |sig_tys| {
298293 let [ resume_ty, tupled_inputs_ty] = * sig_tys. inputs ( ) . as_slice ( ) else {
@@ -302,7 +297,6 @@ impl<I: Interner> CoroutineClosureArgs<I> {
302297 panic ! ( )
303298 } ;
304299 CoroutineClosureSignature {
305- interior,
306300 tupled_inputs_ty,
307301 resume_ty,
308302 yield_ty,
@@ -318,10 +312,6 @@ impl<I: Interner> CoroutineClosureArgs<I> {
318312 self . split ( ) . coroutine_captures_by_ref_ty
319313 }
320314
321- pub fn coroutine_witness_ty ( self ) -> I :: Ty {
322- self . split ( ) . coroutine_witness_ty
323- }
324-
325315 pub fn has_self_borrows ( & self ) -> bool {
326316 match self . coroutine_captures_by_ref_ty ( ) . kind ( ) {
327317 ty:: FnPtr ( sig_tys, _) => sig_tys
@@ -361,7 +351,6 @@ impl<I: Interner> TypeVisitor<I> for HasRegionsBoundAt {
361351#[ derive_where( Clone , Copy , PartialEq , Eq , Hash , Debug ; I : Interner ) ]
362352#[ derive( TypeVisitable_Generic , TypeFoldable_Generic ) ]
363353pub struct CoroutineClosureSignature < I : Interner > {
364- pub interior : I :: Ty ,
365354 pub tupled_inputs_ty : I :: Ty ,
366355 pub resume_ty : I :: Ty ,
367356 pub yield_ty : I :: Ty ,
@@ -407,7 +396,6 @@ impl<I: Interner> CoroutineClosureSignature<I> {
407396 resume_ty : self . resume_ty ,
408397 yield_ty : self . yield_ty ,
409398 return_ty : self . return_ty ,
410- witness : self . interior ,
411399 tupled_upvars_ty,
412400 } ,
413401 ) ;
@@ -587,11 +575,6 @@ pub struct CoroutineArgsParts<I: Interner> {
587575 pub yield_ty : I :: Ty ,
588576 pub return_ty : I :: Ty ,
589577
590- /// The interior type of the coroutine.
591- /// Represents all types that are stored in locals
592- /// in the coroutine's body.
593- pub witness : I :: Ty ,
594-
595578 /// The upvars captured by the closure. Remains an inference variable
596579 /// until the upvar analysis, which happens late in HIR typeck.
597580 pub tupled_upvars_ty : I :: Ty ,
@@ -607,7 +590,6 @@ impl<I: Interner> CoroutineArgs<I> {
607590 parts. resume_ty . into ( ) ,
608591 parts. yield_ty . into ( ) ,
609592 parts. return_ty . into ( ) ,
610- parts. witness . into ( ) ,
611593 parts. tupled_upvars_ty . into ( ) ,
612594 ] ) ) ,
613595 }
@@ -629,15 +611,6 @@ impl<I: Interner> CoroutineArgs<I> {
629611 self . split ( ) . kind_ty
630612 }
631613
632- /// This describes the types that can be contained in a coroutine.
633- /// It will be a type variable initially and unified in the last stages of typeck of a body.
634- /// It contains a tuple of all the types that could end up on a coroutine frame.
635- /// The state transformation MIR pass may only produce layouts which mention types
636- /// in this tuple. Upvars are not counted here.
637- pub fn witness ( self ) -> I :: Ty {
638- self . split ( ) . witness
639- }
640-
641614 /// Returns an iterator over the list of types of captured paths by the coroutine.
642615 /// In case there was a type error in figuring out the types of the captured path, an
643616 /// empty iterator is returned.
0 commit comments