@@ -965,7 +965,7 @@ pub trait PrettyPrinter<'tcx>: Printer<'tcx> + fmt::Write {
965
965
define_scoped_cx ! ( cx) ;
966
966
// Get the (single) generic ty (the args) of this FnOnce trait ref.
967
967
let generics = tcx. generics_of ( trait_ref. def_id ) ;
968
- let ( own_args, _ ) = generics. own_args_no_defaults ( tcx, trait_ref. args ) ;
968
+ let own_args = generics. own_args_no_defaults ( tcx, trait_ref. args ) ;
969
969
970
970
match ( entry. return_ty , own_args[ 0 ] . expect_ty ( ) ) {
971
971
// We can only print `impl Fn() -> ()` if we have a tuple of args and we recorded
@@ -1031,7 +1031,7 @@ pub trait PrettyPrinter<'tcx>: Printer<'tcx> + fmt::Write {
1031
1031
p ! ( print( trait_ref. print_only_trait_name( ) ) ) ;
1032
1032
1033
1033
let generics = tcx. generics_of ( trait_ref. def_id ) ;
1034
- let ( own_args, _ ) = generics. own_args_no_defaults ( tcx, trait_ref. args ) ;
1034
+ let own_args = generics. own_args_no_defaults ( tcx, trait_ref. args ) ;
1035
1035
1036
1036
if !own_args. is_empty ( ) || !assoc_items. is_empty ( ) {
1037
1037
let mut first = true ;
@@ -1183,7 +1183,6 @@ pub trait PrettyPrinter<'tcx>: Printer<'tcx> + fmt::Write {
1183
1183
)
1184
1184
} ,
1185
1185
& alias_ty. args [ 1 ..] ,
1186
- & self . tcx ( ) . generics_of ( alias_ty. def_id ) . params ,
1187
1186
)
1188
1187
}
1189
1188
@@ -1232,7 +1231,7 @@ pub trait PrettyPrinter<'tcx>: Printer<'tcx> + fmt::Write {
1232
1231
let dummy_cx = Ty :: new_fresh ( cx. tcx ( ) , 0 ) ;
1233
1232
let principal = principal. with_self_ty ( cx. tcx ( ) , dummy_cx) ;
1234
1233
1235
- let ( args, _ ) = cx
1234
+ let args = cx
1236
1235
. tcx ( )
1237
1236
. generics_of ( principal. def_id )
1238
1237
. own_args_no_defaults ( cx. tcx ( ) , principal. args ) ;
@@ -2030,26 +2029,14 @@ impl<'tcx> Printer<'tcx> for FmtPrinter<'_, 'tcx> {
2030
2029
& mut self ,
2031
2030
print_prefix : impl FnOnce ( & mut Self ) -> Result < ( ) , PrintError > ,
2032
2031
args : & [ GenericArg < ' tcx > ] ,
2033
- params : & [ ty:: GenericParamDef ] ,
2034
2032
) -> Result < ( ) , PrintError > {
2035
2033
print_prefix ( self ) ?;
2036
2034
2037
- let tcx = self . tcx ;
2038
- let verbose = tcx. sess . verbose ( ) ;
2039
- let mut args = args
2040
- . iter ( )
2041
- . copied ( )
2042
- . zip ( params)
2043
- // If -Zverbose is passed, we should print the host parameter instead
2044
- // of eating it.
2045
- . filter ( |( _, param) | verbose || !param. is_host_effect ( ) )
2046
- . peekable ( ) ;
2047
-
2048
- if args. peek ( ) . is_some ( ) {
2035
+ if !args. is_empty ( ) {
2049
2036
if self . in_value {
2050
2037
write ! ( self , "::" ) ?;
2051
2038
}
2052
- self . generic_delimiters ( |cx| cx. comma_sep ( args. map ( | ( arg , _ ) | arg ) ) )
2039
+ self . generic_delimiters ( |cx| cx. comma_sep ( args. iter ( ) . copied ( ) ) )
2053
2040
} else {
2054
2041
Ok ( ( ) )
2055
2042
}
@@ -2881,7 +2868,8 @@ define_print_and_forward_display! {
2881
2868
TraitPredPrintModifiersAndPath <' tcx> {
2882
2869
if let Some ( idx) = cx. tcx( ) . generics_of( self . 0 . trait_ref. def_id) . host_effect_index
2883
2870
{
2884
- if self . 0 . trait_ref. args. const_at( idx) != cx. tcx( ) . consts. true_ {
2871
+ let arg = self . 0 . trait_ref. args. const_at( idx) ;
2872
+ if arg != cx. tcx( ) . consts. true_ && !arg. has_infer( ) {
2885
2873
p!( "~const " ) ;
2886
2874
}
2887
2875
}
0 commit comments