@@ -1019,26 +1019,25 @@ impl HirDisplay for Ty {
10191019 let ( parent_len, self_param, type_, const_, impl_, lifetime) =
10201020 generics. provenance_split ( ) ;
10211021 let parameters = parameters. as_slice ( Interner ) ;
1022+ debug_assert_eq ! (
1023+ parameters. len( ) ,
1024+ parent_len + self_param as usize + type_ + const_ + impl_ + lifetime
1025+ ) ;
10221026 // We print all params except implicit impl Trait params. Still a bit weird; should we leave out parent and self?
10231027 if parameters. len ( ) - impl_ > 0 {
10241028 // `parameters` are in the order of fn's params (including impl traits), fn's lifetimes
1029+ let parameters =
1030+ generic_args_sans_defaults ( f, Some ( generic_def_id) , parameters) ;
10251031 let without_impl = self_param as usize + type_ + const_ + lifetime;
10261032 // parent's params (those from enclosing impl or trait, if any).
10271033 let ( fn_params, parent_params) = parameters. split_at ( without_impl + impl_) ;
1028- debug_assert_eq ! ( parent_params. len( ) , parent_len) ;
1029-
1030- let parent_params =
1031- generic_args_sans_defaults ( f, Some ( generic_def_id) , parent_params) ;
1032- let fn_params =
1033- & generic_args_sans_defaults ( f, Some ( generic_def_id) , fn_params)
1034- [ 0 ..without_impl] ;
10351034
10361035 write ! ( f, "<" ) ?;
10371036 hir_fmt_generic_arguments ( f, parent_params, None ) ?;
10381037 if !parent_params. is_empty ( ) && !fn_params. is_empty ( ) {
10391038 write ! ( f, ", " ) ?;
10401039 }
1041- hir_fmt_generic_arguments ( f, fn_params, None ) ?;
1040+ hir_fmt_generic_arguments ( f, & fn_params[ 0 ..without_impl ] , None ) ?;
10421041 write ! ( f, ">" ) ?;
10431042 }
10441043 }
0 commit comments