@@ -608,9 +608,7 @@ fn encode_ty<'tcx>(
608608 }
609609
610610 // Function types
611- ty:: FnDef ( def_id, substs)
612- | ty:: Closure ( def_id, substs)
613- | ty:: Generator ( def_id, substs, ..) => {
611+ ty:: FnDef ( def_id, substs) | ty:: Closure ( def_id, substs) => {
614612 // u<length><name>[I<element-type1..element-typeN>E], where <element-type> is <subst>,
615613 // as vendor extended type.
616614 let mut s = String :: new ( ) ;
@@ -621,6 +619,23 @@ fn encode_ty<'tcx>(
621619 typeid. push_str ( & s) ;
622620 }
623621
622+ ty:: Generator ( def_id, substs, ..) => {
623+ // u<length><name>[I<element-type1..element-typeN>E], where <element-type> is <subst>,
624+ // as vendor extended type.
625+ let mut s = String :: new ( ) ;
626+ let name = encode_ty_name ( tcx, * def_id) ;
627+ let _ = write ! ( s, "u{}{}" , name. len( ) , & name) ;
628+ // Encode parent substs only
629+ s. push_str ( & encode_substs (
630+ tcx,
631+ tcx. mk_substs ( substs. as_generator ( ) . parent_substs ( ) ) ,
632+ dict,
633+ options,
634+ ) ) ;
635+ compress ( dict, DictKey :: Ty ( ty, TyQ :: None ) , & mut s) ;
636+ typeid. push_str ( & s) ;
637+ }
638+
624639 // Pointer types
625640 ty:: Ref ( region, ty0, ..) => {
626641 // [U3mut]u3refI<element-type>E as vendor extended type qualifier and type
@@ -739,7 +754,12 @@ fn transform_ty<'tcx>(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>, options: TransformTyOptio
739754 let mut ty = ty;
740755
741756 match ty. kind ( ) {
742- ty:: Float ( ..) | ty:: Char | ty:: Str | ty:: Never | ty:: Foreign ( ..) => { }
757+ ty:: Float ( ..)
758+ | ty:: Char
759+ | ty:: Str
760+ | ty:: Never
761+ | ty:: Foreign ( ..)
762+ | ty:: GeneratorWitness ( ..) => { }
743763
744764 ty:: Bool => {
745765 if options. contains ( EncodeTyOptions :: NORMALIZE_INTEGERS ) {
@@ -922,7 +942,6 @@ fn transform_ty<'tcx>(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>, options: TransformTyOptio
922942
923943 ty:: Bound ( ..)
924944 | ty:: Error ( ..)
925- | ty:: GeneratorWitness ( ..)
926945 | ty:: GeneratorWitnessMIR ( ..)
927946 | ty:: Infer ( ..)
928947 | ty:: Alias ( ..)
0 commit comments