rust-lang / rust-lang/rust-analyzer

Can not find reference of method inside call of macros

Open
#12,067 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
16.9k
Forks
2.2k
Avg merge
1d 12h
Merged PRs (30d)
72

Description

rust-analyzer version: (eg. output of "Rust Analyzer: Show RA Version" command)
rust-analyzer version: 1db66b96c 2022-04-21 dev

rustc version: (eg. output of rustc -V)
rustc 1.60.0 (7737e0b5c 2022-04-04)

For code bellow rust-analyzer if ask "Find all references for Foo::f" shows only
fn f(&self) and foo.f(), but call_f!() is not considered as reference.

struct Foo {}

impl Foo {
    fn f(&self) { println!("you call Foo::f"); }
}

macro_rules! call_f {
    ($obj:ident) => {
        $obj.f();
    };
}

fn main() {

   let foo = Foo {};
   foo.f();
   call_f!(foo);
}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the missing reference with the supplied Rust snippet and the reported rust-analyzer version, then inspect how find-all-references handles macro expansion and method resolution. Done means the reference inside call_f! is included alongside the direct method call references.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.