File tree 1 file changed +26
-1
lines changed
1 file changed +26
-1
lines changed Original file line number Diff line number Diff line change @@ -57,7 +57,8 @@ pub(crate) fn incoming_calls(
57
57
. flat_map ( |func| func. usages ( sema) . all ( ) ) ;
58
58
59
59
for ( _, references) in references {
60
- let references = references. into_iter ( ) . map ( |FileReference { name, .. } | name) ;
60
+ let references =
61
+ references. iter ( ) . filter_map ( |FileReference { name, .. } | name. as_name_ref ( ) ) ;
61
62
for name in references {
62
63
// This target is the containing function
63
64
let nav = sema. ancestors_with_macros ( name. syntax ( ) . clone ( ) ) . find_map ( |node| {
@@ -457,4 +458,28 @@ fn caller$0() {
457
458
expect ! [ [ ] ] ,
458
459
) ;
459
460
}
461
+
462
+ #[ test]
463
+ fn test_trait_method_call_hierarchy ( ) {
464
+ check_hierarchy (
465
+ r#"
466
+ trait T1 {
467
+ fn call$0ee();
468
+ }
469
+
470
+ struct S1;
471
+
472
+ impl T1 for S1 {
473
+ fn callee() {}
474
+ }
475
+
476
+ fn caller() {
477
+ S1::callee();
478
+ }
479
+ "# ,
480
+ expect ! [ [ "callee Function FileId(0) 15..27 18..24" ] ] ,
481
+ expect ! [ [ "caller Function FileId(0) 82..115 85..91 : [104..110]" ] ] ,
482
+ expect ! [ [ ] ] ,
483
+ ) ;
484
+ }
460
485
}
You can’t perform that action at this time.
0 commit comments