@@ -609,9 +609,7 @@ fn encode_ty<'tcx>(
609609 }
610610
611611 // Function types
612- ty:: FnDef ( def_id, substs)
613- | ty:: Closure ( def_id, substs)
614- | ty:: Generator ( def_id, substs, ..) => {
612+ ty:: FnDef ( def_id, substs) | ty:: Closure ( def_id, substs) => {
615613 // u<length><name>[I<element-type1..element-typeN>E], where <element-type> is <subst>,
616614 // as vendor extended type.
617615 let mut s = String :: new ( ) ;
@@ -622,6 +620,23 @@ fn encode_ty<'tcx>(
622620 typeid. push_str ( & s) ;
623621 }
624622
623+ ty:: Generator ( def_id, substs, ..) => {
624+ // u<length><name>[I<element-type1..element-typeN>E], where <element-type> is <subst>,
625+ // as vendor extended type.
626+ let mut s = String :: new ( ) ;
627+ let name = encode_ty_name ( tcx, * def_id) ;
628+ let _ = write ! ( s, "u{}{}" , name. len( ) , & name) ;
629+ // Encode parent substs only
630+ s. push_str ( & encode_substs (
631+ tcx,
632+ tcx. mk_substs ( substs. as_generator ( ) . parent_substs ( ) ) ,
633+ dict,
634+ options,
635+ ) ) ;
636+ compress ( dict, DictKey :: Ty ( ty, TyQ :: None ) , & mut s) ;
637+ typeid. push_str ( & s) ;
638+ }
639+
625640 // Pointer types
626641 ty:: Ref ( region, ty0, ..) => {
627642 // [U3mut]u3refI<element-type>E as vendor extended type qualifier and type
@@ -740,7 +755,12 @@ fn transform_ty<'tcx>(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>, options: TransformTyOptio
740755 let mut ty = ty;
741756
742757 match ty. kind ( ) {
743- ty:: Float ( ..) | ty:: Char | ty:: Str | ty:: Never | ty:: Foreign ( ..) => { }
758+ ty:: Float ( ..)
759+ | ty:: Char
760+ | ty:: Str
761+ | ty:: Never
762+ | ty:: Foreign ( ..)
763+ | ty:: GeneratorWitness ( ..) => { }
744764
745765 ty:: Bool => {
746766 if options. contains ( EncodeTyOptions :: NORMALIZE_INTEGERS ) {
@@ -928,7 +948,6 @@ fn transform_ty<'tcx>(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>, options: TransformTyOptio
928948
929949 ty:: Bound ( ..)
930950 | ty:: Error ( ..)
931- | ty:: GeneratorWitness ( ..)
932951 | ty:: GeneratorWitnessMIR ( ..)
933952 | ty:: Infer ( ..)
934953 | ty:: Alias ( ..)
0 commit comments