@@ -232,7 +232,7 @@ pub trait PrettyPrinter<'tcx>: Printer<'tcx> + fmt::Write {
232
232
f : F ,
233
233
) -> Result < ( ) , PrintError >
234
234
where
235
- T : Print < ' tcx , Self > + TypeFoldable < TyCtxt < ' tcx > > ,
235
+ T : TypeFoldable < TyCtxt < ' tcx > > ,
236
236
{
237
237
f ( value. as_ref ( ) . skip_binder ( ) , self )
238
238
}
@@ -1056,7 +1056,7 @@ pub trait PrettyPrinter<'tcx>: Printer<'tcx> + fmt::Write {
1056
1056
// Insert parenthesis around (Fn(A, B) -> C) if the opaque ty has more than one other trait
1057
1057
let paren_needed = fn_traits. len ( ) > 1 || traits. len ( ) > 0 || !has_sized_bound;
1058
1058
1059
- for ( ( bound_args , is_async) , entry) in fn_traits {
1059
+ for ( ( bound_args_and_self_ty , is_async) , entry) in fn_traits {
1060
1060
write ! ( self , "{}" , if first { "" } else { " + " } ) ?;
1061
1061
write ! ( self , "{}" , if paren_needed { "(" } else { "" } ) ?;
1062
1062
@@ -1067,7 +1067,7 @@ pub trait PrettyPrinter<'tcx>: Printer<'tcx> + fmt::Write {
1067
1067
} ;
1068
1068
1069
1069
if let Some ( return_ty) = entry. return_ty {
1070
- self . wrap_binder ( & bound_args , |args, cx| {
1070
+ self . wrap_binder ( & bound_args_and_self_ty , |( args, _ ) , cx| {
1071
1071
define_scoped_cx ! ( cx) ;
1072
1072
p ! ( write( "{}" , tcx. item_name( trait_def_id) ) ) ;
1073
1073
p ! ( "(" ) ;
@@ -1093,9 +1093,13 @@ pub trait PrettyPrinter<'tcx>: Printer<'tcx> + fmt::Write {
1093
1093
} else {
1094
1094
// Otherwise, render this like a regular trait.
1095
1095
traits. insert (
1096
- bound_args . map_bound ( |args| ty:: TraitPredicate {
1096
+ bound_args_and_self_ty . map_bound ( |( args, self_ty ) | ty:: TraitPredicate {
1097
1097
polarity : ty:: PredicatePolarity :: Positive ,
1098
- trait_ref : ty:: TraitRef :: new ( tcx, trait_def_id, [ Ty :: new_tup ( tcx, args) ] ) ,
1098
+ trait_ref : ty:: TraitRef :: new (
1099
+ tcx,
1100
+ trait_def_id,
1101
+ [ self_ty, Ty :: new_tup ( tcx, args) ] ,
1102
+ ) ,
1099
1103
} ) ,
1100
1104
FxIndexMap :: default ( ) ,
1101
1105
) ;
@@ -1229,7 +1233,7 @@ pub trait PrettyPrinter<'tcx>: Printer<'tcx> + fmt::Write {
1229
1233
FxIndexMap < DefId , ty:: Binder < ' tcx , Term < ' tcx > > > ,
1230
1234
> ,
1231
1235
fn_traits : & mut FxIndexMap <
1232
- ( ty:: Binder < ' tcx , & ' tcx ty:: List < Ty < ' tcx > > > , bool ) ,
1236
+ ( ty:: Binder < ' tcx , ( & ' tcx ty:: List < Ty < ' tcx > > , Ty < ' tcx > ) > , bool ) ,
1233
1237
OpaqueFnEntry < ' tcx > ,
1234
1238
> ,
1235
1239
) {
@@ -1249,7 +1253,7 @@ pub trait PrettyPrinter<'tcx>: Printer<'tcx> + fmt::Write {
1249
1253
&& let ty:: Tuple ( types) = * trait_pred. skip_binder ( ) . trait_ref . args . type_at ( 1 ) . kind ( )
1250
1254
{
1251
1255
let entry = fn_traits
1252
- . entry ( ( trait_pred. rebind ( types) , is_async) )
1256
+ . entry ( ( trait_pred. rebind ( ( types, trait_pred . skip_binder ( ) . self_ty ( ) ) ) , is_async) )
1253
1257
. or_insert_with ( || OpaqueFnEntry { kind, return_ty : None } ) ;
1254
1258
if kind. extends ( entry. kind ) {
1255
1259
entry. kind = kind;
@@ -2379,7 +2383,7 @@ impl<'tcx> PrettyPrinter<'tcx> for FmtPrinter<'_, 'tcx> {
2379
2383
f : C ,
2380
2384
) -> Result < ( ) , PrintError >
2381
2385
where
2382
- T : Print < ' tcx , Self > + TypeFoldable < TyCtxt < ' tcx > > ,
2386
+ T : TypeFoldable < TyCtxt < ' tcx > > ,
2383
2387
{
2384
2388
self . pretty_wrap_binder ( value, f)
2385
2389
}
@@ -2633,7 +2637,7 @@ impl<'tcx> FmtPrinter<'_, 'tcx> {
2633
2637
value : & ty:: Binder < ' tcx , T > ,
2634
2638
) -> Result < ( T , UnordMap < ty:: BoundRegion , ty:: Region < ' tcx > > ) , fmt:: Error >
2635
2639
where
2636
- T : Print < ' tcx , Self > + TypeFoldable < TyCtxt < ' tcx > > ,
2640
+ T : TypeFoldable < TyCtxt < ' tcx > > ,
2637
2641
{
2638
2642
fn name_by_region_index (
2639
2643
index : usize ,
@@ -2814,7 +2818,7 @@ impl<'tcx> FmtPrinter<'_, 'tcx> {
2814
2818
f : C ,
2815
2819
) -> Result < ( ) , fmt:: Error >
2816
2820
where
2817
- T : Print < ' tcx , Self > + TypeFoldable < TyCtxt < ' tcx > > ,
2821
+ T : TypeFoldable < TyCtxt < ' tcx > > ,
2818
2822
{
2819
2823
let old_region_index = self . region_index ;
2820
2824
let ( new_value, _) = self . name_all_regions ( value) ?;
0 commit comments