@@ -641,9 +641,7 @@ fn encode_ty<'tcx>(
641641 }
642642
643643 // Function types
644- ty:: FnDef ( def_id, args)
645- | ty:: Closure ( def_id, args)
646- | ty:: CoroutineClosure ( def_id, args) => {
644+ ty:: FnDef ( def_id, args) | ty:: Closure ( def_id, args) => {
647645 // u<length><name>[I<element-type1..element-typeN>E], where <element-type> is <subst>,
648646 // as vendor extended type.
649647 let mut s = String :: new ( ) ;
@@ -653,6 +651,17 @@ fn encode_ty<'tcx>(
653651 compress ( dict, DictKey :: Ty ( ty, TyQ :: None ) , & mut s) ;
654652 typeid. push_str ( & s) ;
655653 }
654+ ty:: CoroutineClosure ( def_id, args) => {
655+ // u<length><name>[I<element-type1..element-typeN>E], where <element-type> is <subst>,
656+ // as vendor extended type.
657+ let mut s = String :: new ( ) ;
658+ let name = encode_ty_name ( tcx, * def_id) ;
659+ let _ = write ! ( s, "u{}{}" , name. len( ) , & name) ;
660+ let parent_args = tcx. mk_args ( args. as_coroutine_closure ( ) . parent_args ( ) ) ;
661+ s. push_str ( & encode_args ( tcx, parent_args, dict, options) ) ;
662+ compress ( dict, DictKey :: Ty ( ty, TyQ :: None ) , & mut s) ;
663+ typeid. push_str ( & s) ;
664+ }
656665
657666 ty:: Coroutine ( def_id, args, ..) => {
658667 // u<length><name>[I<element-type1..element-typeN>E], where <element-type> is <subst>,
@@ -735,8 +744,8 @@ fn encode_ty<'tcx>(
735744 ty:: Alias ( ..)
736745 | ty:: Bound ( ..)
737746 | ty:: Error ( ..)
738- | ty:: CoroutineWitness ( ..)
739747 | ty:: Infer ( ..)
748+ | ty:: CoroutineWitness ( ..)
740749 | ty:: Placeholder ( ..) => {
741750 bug ! ( "encode_ty: unexpected `{:?}`" , ty. kind( ) ) ;
742751 }
@@ -922,6 +931,10 @@ fn transform_ty<'tcx>(
922931 ty = Ty :: new_closure ( tcx, * def_id, transform_args ( tcx, args, parents, options) ) ;
923932 }
924933
934+ ty:: Coroutine ( def_id, args) => {
935+ ty = Ty :: new_coroutine ( tcx, * def_id, transform_args ( tcx, args, parents, options) ) ;
936+ }
937+
925938 ty:: CoroutineClosure ( def_id, args) => {
926939 ty = Ty :: new_coroutine_closure (
927940 tcx,
@@ -930,10 +943,6 @@ fn transform_ty<'tcx>(
930943 ) ;
931944 }
932945
933- ty:: Coroutine ( def_id, args) => {
934- ty = Ty :: new_coroutine ( tcx, * def_id, transform_args ( tcx, args, parents, options) ) ;
935- }
936-
937946 ty:: Ref ( region, ty0, ..) => {
938947 if options. contains ( TransformTyOptions :: GENERALIZE_POINTERS ) {
939948 if ty. is_mutable_ptr ( ) {
0 commit comments