File tree 2 files changed +27
-4
lines changed
src/tools/rust-analyzer/crates
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 {
1022
1022
// We print all params except implicit impl Trait params. Still a bit weird; should we leave out parent and self?
1023
1023
if parameters. len ( ) - impl_ > 0 {
1024
1024
// `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;
1025
1026
// 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_) ;
1029
1028
debug_assert_eq ! ( parent_params. len( ) , parent_len) ;
1030
1029
1031
1030
let parent_params =
1032
1031
generic_args_sans_defaults ( f, Some ( generic_def_id) , parent_params) ;
1033
1032
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] ;
1035
1035
1036
1036
write ! ( f, "<" ) ?;
1037
1037
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) {}
8579
8579
"# ] ] ,
8580
8580
) ;
8581
8581
}
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