@@ -905,29 +905,27 @@ pub trait PrettyPrinter<'tcx>:
905
905
}
906
906
907
907
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
- } ;
915
908
if !first {
916
909
p ! ( ", " ) ;
917
910
}
918
911
p ! ( write( "{} = " , self . tcx( ) . associated_item( assoc_item_def_id) . ident) ) ;
919
912
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
+ }
926
924
}
927
- _ => {
928
- p ! ( print( ty ) )
925
+ Term :: Const ( c ) => {
926
+ p ! ( print( c ) ) ;
929
927
}
930
- }
928
+ } ;
931
929
932
930
first = false ;
933
931
}
@@ -1031,7 +1029,11 @@ pub trait PrettyPrinter<'tcx>:
1031
1029
let mut projections = predicates. projection_bounds ( ) ;
1032
1030
if let ( Some ( proj) , None ) = ( projections. next ( ) , projections. next ( ) ) {
1033
1031
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
+ ) ) ;
1035
1037
resugared = true ;
1036
1038
}
1037
1039
}
@@ -2454,7 +2456,7 @@ define_print_and_forward_display! {
2454
2456
2455
2457
ty:: ExistentialProjection <' tcx> {
2456
2458
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 ) )
2458
2460
}
2459
2461
2460
2462
ty:: ExistentialPredicate <' tcx> {
0 commit comments