@@ -601,9 +601,7 @@ fn encode_ty<'tcx>(
601
601
}
602
602
603
603
// 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) => {
607
605
// u<length><name>[I<element-type1..element-typeN>E], where <element-type> is <subst>,
608
606
// as vendor extended type.
609
607
let mut s = String :: new ( ) ;
@@ -614,6 +612,23 @@ fn encode_ty<'tcx>(
614
612
typeid. push_str ( & s) ;
615
613
}
616
614
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
+
617
632
// Pointer types
618
633
ty:: Ref ( region, ty0, ..) => {
619
634
// [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
732
747
let mut ty = ty;
733
748
734
749
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 ( ..) => { }
736
756
737
757
ty:: Bool => {
738
758
if options. contains ( EncodeTyOptions :: NORMALIZE_INTEGERS ) {
@@ -915,7 +935,6 @@ fn transform_ty<'tcx>(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>, options: TransformTyOptio
915
935
916
936
ty:: Bound ( ..)
917
937
| ty:: Error ( ..)
918
- | ty:: GeneratorWitness ( ..)
919
938
| ty:: GeneratorWitnessMIR ( ..)
920
939
| ty:: Infer ( ..)
921
940
| ty:: Alias ( ..)
0 commit comments