@@ -965,7 +965,7 @@ pub trait PrettyPrinter<'tcx>: Printer<'tcx> + fmt::Write {
965965 define_scoped_cx ! ( cx) ;
966966 // Get the (single) generic ty (the args) of this FnOnce trait ref.
967967 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 ) ;
969969
970970 match ( entry. return_ty , own_args[ 0 ] . expect_ty ( ) ) {
971971 // 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 {
10311031 p ! ( print( trait_ref. print_only_trait_name( ) ) ) ;
10321032
10331033 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 ) ;
10351035
10361036 if !own_args. is_empty ( ) || !assoc_items. is_empty ( ) {
10371037 let mut first = true ;
@@ -1183,7 +1183,6 @@ pub trait PrettyPrinter<'tcx>: Printer<'tcx> + fmt::Write {
11831183 )
11841184 } ,
11851185 & alias_ty. args [ 1 ..] ,
1186- & self . tcx ( ) . generics_of ( alias_ty. def_id ) . params ,
11871186 )
11881187 }
11891188
@@ -1232,7 +1231,7 @@ pub trait PrettyPrinter<'tcx>: Printer<'tcx> + fmt::Write {
12321231 let dummy_cx = Ty :: new_fresh ( cx. tcx ( ) , 0 ) ;
12331232 let principal = principal. with_self_ty ( cx. tcx ( ) , dummy_cx) ;
12341233
1235- let ( args, _ ) = cx
1234+ let args = cx
12361235 . tcx ( )
12371236 . generics_of ( principal. def_id )
12381237 . own_args_no_defaults ( cx. tcx ( ) , principal. args ) ;
@@ -2030,26 +2029,14 @@ impl<'tcx> Printer<'tcx> for FmtPrinter<'_, 'tcx> {
20302029 & mut self ,
20312030 print_prefix : impl FnOnce ( & mut Self ) -> Result < ( ) , PrintError > ,
20322031 args : & [ GenericArg < ' tcx > ] ,
2033- params : & [ ty:: GenericParamDef ] ,
20342032 ) -> Result < ( ) , PrintError > {
20352033 print_prefix ( self ) ?;
20362034
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 ( ) {
20492036 if self . in_value {
20502037 write ! ( self , "::" ) ?;
20512038 }
2052- self . generic_delimiters ( |cx| cx. comma_sep ( args. map ( | ( arg , _ ) | arg ) ) )
2039+ self . generic_delimiters ( |cx| cx. comma_sep ( args. iter ( ) . copied ( ) ) )
20532040 } else {
20542041 Ok ( ( ) )
20552042 }
@@ -2881,7 +2868,8 @@ define_print_and_forward_display! {
28812868 TraitPredPrintModifiersAndPath <' tcx> {
28822869 if let Some ( idx) = cx. tcx( ) . generics_of( self . 0 . trait_ref. def_id) . host_effect_index
28832870 {
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( ) {
28852873 p!( "~const " ) ;
28862874 }
28872875 }
0 commit comments