@@ -608,9 +608,7 @@ fn encode_ty<'tcx>(
608
608
}
609
609
610
610
// 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) => {
614
612
// u<length><name>[I<element-type1..element-typeN>E], where <element-type> is <subst>,
615
613
// as vendor extended type.
616
614
let mut s = String :: new ( ) ;
@@ -621,6 +619,23 @@ fn encode_ty<'tcx>(
621
619
typeid. push_str ( & s) ;
622
620
}
623
621
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
+
624
639
// Pointer types
625
640
ty:: Ref ( region, ty0, ..) => {
626
641
// [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
739
754
let mut ty = ty;
740
755
741
756
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 ( ..) => { }
743
763
744
764
ty:: Bool => {
745
765
if options. contains ( EncodeTyOptions :: NORMALIZE_INTEGERS ) {
@@ -922,7 +942,6 @@ fn transform_ty<'tcx>(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>, options: TransformTyOptio
922
942
923
943
ty:: Bound ( ..)
924
944
| ty:: Error ( ..)
925
- | ty:: GeneratorWitness ( ..)
926
945
| ty:: GeneratorWitnessMIR ( ..)
927
946
| ty:: Infer ( ..)
928
947
| ty:: Alias ( ..)
0 commit comments