File tree Expand file tree Collapse file tree 1 file changed +26
-1
lines changed Expand file tree Collapse file tree 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(
5757 . flat_map ( |func| func. usages ( sema) . all ( ) ) ;
5858
5959 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 ( ) ) ;
6162 for name in references {
6263 // This target is the containing function
6364 let nav = sema. ancestors_with_macros ( name. syntax ( ) . clone ( ) ) . find_map ( |node| {
@@ -457,4 +458,28 @@ fn caller$0() {
457458 expect ! [ [ ] ] ,
458459 ) ;
459460 }
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+ }
460485}
You can’t perform that action at this time.
0 commit comments