rust-analyzer: Macro invocation Error for simple dbg macro
The following code shows an error of “failed to parse or resolve macro invocation” in master bb697727a
fn main() {
dbg!("test");
}
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 10
- Comments: 21 (9 by maintainers)
Commits related to this issue
- Merge #6751 6751: Use the right `def_crate` for builtin macros r=jonas-schievink a=jonas-schievink Fixes the incorrect macro resolution in https://github.com/rust-analyzer/rust-analyzer/issues/6716 ... — committed to rust-lang/rust-analyzer by bors[bot] 4 years ago
- Add test for `$crate` in builtin macros Fixes #6716 — committed to Matthias-Fauconneau/rust-analyzer by jonas-schievink 4 years ago
The warning can be disabled using:
At this point there’s no need for more confirmations.
The resolution error should now be fixed. I’ll look into the misplaced diagnostics later.
I just compiled the
rust-analyzer-gitpackage on ArchLinux, but I’m still seeing failed to parse macro invocation for my invocation of theserde_json::json!macro.(the misplaced diagnostics are now also fixed)
Same as @jeromegn , I am still getting the error on the nightly version of rust-analyzer, in my case in a call to
futures::try_join!.I started getting this error after I updated to 0.2.408. Reverting to 0.2.400 fixes the issue. In addition to dbg!, usage of assert_eq! with a message seemed to cause this as well. I’m on Ubuntu 20.04.1 LTS and vscode
if that’s of any interest.
In my case the issue also causes error flood in seemingly unrelated parts of the source file. For example, somewhere in the source I can have the following lines:
And it causes the following errors within the same file: <image src="https://user-images.githubusercontent.com/3784017/101149626-c75ddb80-3651-11eb-8652-61198e538e4b.png" width="50%" height="50%">
P.S.: If I comment the
dbg!line all errors disappear.You can use the nightly version, but I’d suggest manually replacing the LSP binary or waiting until tomorrow because of a Code extension bug related to the update functionality (#6757).
Or you could disable the warning.