File tree Expand file tree Collapse file tree 2 files changed +27
-4
lines changed Expand file tree Collapse file tree 2 files changed +27
-4
lines changed Original file line number Diff line number Diff line change @@ -1022,16 +1022,16 @@ impl HirDisplay for Ty {
10221022 // We print all params except implicit impl Trait params. Still a bit weird; should we leave out parent and self?
10231023 if parameters. len ( ) - impl_ > 0 {
10241024 // `parameters` are in the order of fn's params (including impl traits), fn's lifetimes
1025+ let without_impl = self_param as usize + type_ + const_ + lifetime;
10251026 // parent's params (those from enclosing impl or trait, if any).
1026- let ( fn_params, other) =
1027- parameters. split_at ( self_param as usize + type_ + const_ + lifetime) ;
1028- let ( _impl, parent_params) = other. split_at ( impl_) ;
1027+ let ( fn_params, parent_params) = parameters. split_at ( without_impl + impl_) ;
10291028 debug_assert_eq ! ( parent_params. len( ) , parent_len) ;
10301029
10311030 let parent_params =
10321031 generic_args_sans_defaults ( f, Some ( generic_def_id) , parent_params) ;
10331032 let fn_params =
1034- generic_args_sans_defaults ( f, Some ( generic_def_id) , fn_params) ;
1033+ & generic_args_sans_defaults ( f, Some ( generic_def_id) , fn_params)
1034+ [ 0 ..without_impl] ;
10351035
10361036 write ! ( f, "<" ) ?;
10371037 hir_fmt_generic_arguments ( f, parent_params, None ) ?;
Original file line number Diff line number Diff line change @@ -8579,3 +8579,26 @@ fn main(a$0: T) {}
85798579 "# ] ] ,
85808580 ) ;
85818581}
8582+
8583+ #[ test]
8584+ fn hover_fn_with_impl_trait_arg ( ) {
8585+ check (
8586+ r#"
8587+ trait Foo {}
8588+ impl Foo for bool {}
8589+ fn bar<const WIDTH: u8>(_: impl Foo) {}
8590+ fn test() {
8591+ let f = bar::<3>;
8592+ f$0(true);
8593+ }
8594+ "# ,
8595+ expect ! [ [ r#"
8596+ *f*
8597+
8598+ ```rust
8599+ // size = 0, align = 1
8600+ let f: fn bar<3>(bool)
8601+ ```
8602+ "# ] ] ,
8603+ ) ;
8604+ }
You can’t perform that action at this time.
0 commit comments