@@ -1019,26 +1019,25 @@ impl HirDisplay for Ty {
1019
1019
let ( parent_len, self_param, type_, const_, impl_, lifetime) =
1020
1020
generics. provenance_split ( ) ;
1021
1021
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
+ ) ;
1022
1026
// We print all params except implicit impl Trait params. Still a bit weird; should we leave out parent and self?
1023
1027
if parameters. len ( ) - impl_ > 0 {
1024
1028
// `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) ;
1025
1031
let without_impl = self_param as usize + type_ + const_ + lifetime;
1026
1032
// parent's params (those from enclosing impl or trait, if any).
1027
1033
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] ;
1035
1034
1036
1035
write ! ( f, "<" ) ?;
1037
1036
hir_fmt_generic_arguments ( f, parent_params, None ) ?;
1038
1037
if !parent_params. is_empty ( ) && !fn_params. is_empty ( ) {
1039
1038
write ! ( f, ", " ) ?;
1040
1039
}
1041
- hir_fmt_generic_arguments ( f, fn_params, None ) ?;
1040
+ hir_fmt_generic_arguments ( f, & fn_params[ 0 ..without_impl ] , None ) ?;
1042
1041
write ! ( f, ">" ) ?;
1043
1042
}
1044
1043
}
0 commit comments