@@ -601,9 +601,7 @@ fn encode_ty<'tcx>(
601601 }
602602
603603 // Function types
604- ty:: FnDef ( def_id, substs)
605- | ty:: Closure ( def_id, substs)
606- | ty:: Generator ( def_id, substs, ..) => {
604+ ty:: FnDef ( def_id, substs) | ty:: Closure ( def_id, substs) => {
607605 // u<length><name>[I<element-type1..element-typeN>E], where <element-type> is <subst>,
608606 // as vendor extended type.
609607 let mut s = String :: new ( ) ;
@@ -614,6 +612,23 @@ fn encode_ty<'tcx>(
614612 typeid. push_str ( & s) ;
615613 }
616614
615+ ty:: Generator ( def_id, substs, ..) => {
616+ // u<length><name>[I<element-type1..element-typeN>E], where <element-type> is <subst>,
617+ // as vendor extended type.
618+ let mut s = String :: new ( ) ;
619+ let name = encode_ty_name ( tcx, * def_id) ;
620+ let _ = write ! ( s, "u{}{}" , name. len( ) , & name) ;
621+ // Encode parent substs only
622+ s. push_str ( & encode_substs (
623+ tcx,
624+ tcx. mk_substs ( substs. as_generator ( ) . parent_substs ( ) ) ,
625+ dict,
626+ options,
627+ ) ) ;
628+ compress ( dict, DictKey :: Ty ( ty, TyQ :: None ) , & mut s) ;
629+ typeid. push_str ( & s) ;
630+ }
631+
617632 // Pointer types
618633 ty:: Ref ( region, ty0, ..) => {
619634 // [U3mut]u3refI<element-type>E as vendor extended type qualifier and type
@@ -732,7 +747,12 @@ fn transform_ty<'tcx>(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>, options: TransformTyOptio
732747 let mut ty = ty;
733748
734749 match ty. kind ( ) {
735- ty:: Float ( ..) | ty:: Char | ty:: Str | ty:: Never | ty:: Foreign ( ..) => { }
750+ ty:: Float ( ..)
751+ | ty:: Char
752+ | ty:: Str
753+ | ty:: Never
754+ | ty:: Foreign ( ..)
755+ | ty:: GeneratorWitness ( ..) => { }
736756
737757 ty:: Bool => {
738758 if options. contains ( EncodeTyOptions :: NORMALIZE_INTEGERS ) {
@@ -915,7 +935,6 @@ fn transform_ty<'tcx>(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>, options: TransformTyOptio
915935
916936 ty:: Bound ( ..)
917937 | ty:: Error ( ..)
918- | ty:: GeneratorWitness ( ..)
919938 | ty:: GeneratorWitnessMIR ( ..)
920939 | ty:: Infer ( ..)
921940 | ty:: Alias ( ..)
0 commit comments