You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If I define a macro inside file foo and the macro is also named foo and reexport it next to the module, rust analyzer seems a bit confused about which foo I'm talking about.
In the image in module bar you can see that rust-analyzer thinks that it is importing a module (green color) but the macro is actually in scope and can be called.
For some reason this seems to subtly break some other things, for example when a macro like this is used to define a struct, that type is not picked up by rust analyzer. See the test at the end of this report for example of how this breaks "goto definition".
This was a bit surprising to me, but I've just noticed I can also call foo::foo!() in the example inside bar.
So the use super::foo; seems to bring both the module and macro to the scope. So the coloring may not be an issue since rust analyzer has to choose one or the other, just the resolution seems wrong.
If I define a macro inside file
foo
and the macro is also namedfoo
and reexport it next to the module, rust analyzer seems a bit confused about whichfoo
I'm talking about.In the image in module
bar
you can see thatrust-analyzer
thinks that it is importing a module (green color) but the macro is actually in scope and can be called.For some reason this seems to subtly break some other things, for example when a macro like this is used to define a struct, that type is not picked up by rust analyzer. See the test at the end of this report for example of how this breaks "goto definition".
rust-analyzer version: Current master,
83ba42043
rustc version: rustc 1.78.0 (9b00956e5 2024-04-29)
editor or extension: VSCode
test to reproduce:
Note that if you rename the
generate
macro so that it is not named as the containing module, the test succeeds.The text was updated successfully, but these errors were encountered: