@@ -905,29 +905,27 @@ pub trait PrettyPrinter<'tcx>:
905905 }
906906
907907 for ( assoc_item_def_id, term) in assoc_items {
908- let ty = match term. skip_binder ( ) {
909- Term :: Ty ( ty) => ty,
910- Term :: Const ( c) => {
911- p ! ( print( c) ) ;
912- continue ;
913- }
914- } ;
915908 if !first {
916909 p ! ( ", " ) ;
917910 }
918911 p ! ( write( "{} = " , self . tcx( ) . associated_item( assoc_item_def_id) . ident) ) ;
919912
920- // Skip printing `<[generator@] as Generator<_>>::Return` from async blocks
921- match ty. kind ( ) {
922- ty:: Projection ( ty:: ProjectionTy { item_def_id, .. } )
923- if Some ( * item_def_id) == self . tcx ( ) . lang_items ( ) . generator_return ( ) =>
924- {
925- p ! ( "[async output]" )
913+ match term. skip_binder ( ) {
914+ Term :: Ty ( ty) => {
915+ // Skip printing `<[generator@] as Generator<_>>::Return` from async blocks
916+ if matches ! (
917+ ty. kind( ) , ty:: Projection ( ty:: ProjectionTy { item_def_id, .. } )
918+ if Some ( * item_def_id) == self . tcx( ) . lang_items( ) . generator_return( )
919+ ) {
920+ p ! ( "[async output]" )
921+ } else {
922+ p ! ( print( ty) )
923+ }
926924 }
927- _ => {
928- p ! ( print( ty ) )
925+ Term :: Const ( c ) => {
926+ p ! ( print( c ) ) ;
929927 }
930- }
928+ } ;
931929
932930 first = false ;
933931 }
@@ -1031,7 +1029,11 @@ pub trait PrettyPrinter<'tcx>:
10311029 let mut projections = predicates. projection_bounds ( ) ;
10321030 if let ( Some ( proj) , None ) = ( projections. next ( ) , projections. next ( ) ) {
10331031 let tys: Vec < _ > = args. iter ( ) . map ( |k| k. expect_ty ( ) ) . collect ( ) ;
1034- p ! ( pretty_fn_sig( & tys, false , proj. skip_binder( ) . ty) ) ;
1032+ p ! ( pretty_fn_sig(
1033+ & tys,
1034+ false ,
1035+ proj. skip_binder( ) . term. ty( ) . expect( "Return type was a const" )
1036+ ) ) ;
10351037 resugared = true ;
10361038 }
10371039 }
@@ -2454,7 +2456,7 @@ define_print_and_forward_display! {
24542456
24552457 ty:: ExistentialProjection <' tcx> {
24562458 let name = cx. tcx( ) . associated_item( self . item_def_id) . ident;
2457- p!( write( "{} = " , name) , print( self . ty ) )
2459+ p!( write( "{} = " , name) , print( self . term ) )
24582460 }
24592461
24602462 ty:: ExistentialPredicate <' tcx> {
0 commit comments