@@ -609,9 +609,7 @@ fn encode_ty<'tcx>(
609
609
}
610
610
611
611
// 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) => {
615
613
// u<length><name>[I<element-type1..element-typeN>E], where <element-type> is <subst>,
616
614
// as vendor extended type.
617
615
let mut s = String :: new ( ) ;
@@ -622,6 +620,23 @@ fn encode_ty<'tcx>(
622
620
typeid. push_str ( & s) ;
623
621
}
624
622
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
+
625
640
// Pointer types
626
641
ty:: Ref ( region, ty0, ..) => {
627
642
// [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
740
755
let mut ty = ty;
741
756
742
757
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 ( ..) => { }
744
764
745
765
ty:: Bool => {
746
766
if options. contains ( EncodeTyOptions :: NORMALIZE_INTEGERS ) {
@@ -928,7 +948,6 @@ fn transform_ty<'tcx>(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>, options: TransformTyOptio
928
948
929
949
ty:: Bound ( ..)
930
950
| ty:: Error ( ..)
931
- | ty:: GeneratorWitness ( ..)
932
951
| ty:: GeneratorWitnessMIR ( ..)
933
952
| ty:: Infer ( ..)
934
953
| ty:: Alias ( ..)
0 commit comments