Stream: t-compiler/rust-analyzer

Topic: Fail to find macro definition under VSCode

pachi (Dec 18 2020 at 10:57, on Zulip):

Hi, I'm using rust-analyzer in VSCode with Gtk, and I'm having problems with some macros. These show an error, "Fail to find macro definition", even if it's indeed on scope (with an use statement) and the code compiles fine. As a result, I don't get type hints or any of the niceties that r-a usually provides (only code highlighting).
Is this a known problem? Is it a problem with my configuration?

Laurențiu (Dec 18 2020 at 11:05, on Zulip):

Did type inference work before?

pachi (Dec 18 2020 at 11:07, on Zulip):

Not for this same macro, AFAICT.
For the rest of the file, there's no problem.

Laurențiu (Dec 18 2020 at 11:08, on Zulip):

It's probably not your configuration. rust-analyzer has a few bugs/limitations wrt. macros and that diagnostic was recently added and made them more visible. You can disable the warning if you want to, and you could also test in the nightly version since a couple of bugs were fixed this week.

pachi (Dec 18 2020 at 11:09, on Zulip):

Ok, then I'll wait for next week's update. Thanks!

Laurențiu (Dec 18 2020 at 11:09, on Zulip):

A minimized test case (copy the clone definition to an empty project) would help if you want to file an issue.

pachi (Dec 18 2020 at 11:09, on Zulip):

I'll have a look, then.

pachi (Dec 18 2020 at 11:11, on Zulip):

It's this macro here: and it's indeed complex.

Laurențiu (Dec 18 2020 at 11:13, on Zulip): is similar and we found an issue in

pachi (Dec 18 2020 at 11:17, on Zulip):

That looks like the same problem. In fact, I don't remember having this problem, but I haven't touched this project for a long time so it may well be the case.
Thanks for your help! It's a pleasure to use r-a!

Laurențiu (Dec 18 2020 at 11:19, on Zulip):

Hmm, this looks like it might be annoying to minimize

Laurențiu (Dec 18 2020 at 11:20, on Zulip):

I still get "Fail to find macro definition" in

Laurențiu (Dec 18 2020 at 11:31, on Zulip):


Laurențiu (Dec 20 2020 at 07:09, on Zulip):

@pachi my @Edwin Cheng's fix for that issue just landed, you could try a source build to see if it's working. Unfortunately, I don't think it will be in tomorrow's release (but I might be wrong about that).

pachi (Dec 20 2020 at 07:20, on Zulip):

@Laurențiu Nicola wow, that's great! I 'm not sure I will be able to do the source build, but thanks for pointing and thanks to @Edwin Cheng . If it gets into tomorrow release I'll report.

Laurențiu (Dec 20 2020 at 07:35, on Zulip):

Just clone and run cargo xtask install :-)

pachi (Dec 23 2020 at 10:10, on Zulip):

I'm using this week's release and the fix is working fine. Thanks a lot!

Last update: Jul 29 2021 at 21:15UTC