-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Macro invocation Error for simple dbg macro #6716
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
In more recent code (b988c6f), the errors are more explicit :
It seem like we couldn't resolve the |
Exactly same thing happens to me with the latest nightly Commenting out dbg! removes the errors. |
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. |
Version: 1.51.1 (system setup) Same thing for me. Started happening today out of nowhere, even after the latest update. I think adding another #[test(cfg)] triggered this but cannot verify. I comment out the code but the error appears in other files. I only appears in open files. Commenting out other code does not help. The error appears in remaining files EDIT: One important thing to note I think is that I'm using Remote-SSH from windows to ubuntu. I cannot as of yet repro this locally on the same code |
Just wanted to confirm the above reports. I have issues by using 0.2.408 with genawaiter macros on Windows. Reverting back to 0.2.400 resolved the issue. |
The warning can be disabled using: "rust-analyzer.diagnostics.disabled": [
"macro-error"
] At this point there's no need for more confirmations. |
|
Reproduction: #[macro_export]
#[rustc_builtin_macro]
macro_rules! format_args {}
#[macro_export]
macro_rules! arg {}
#[macro_export]
macro_rules! outer {
() => {
$crate::format_args!( "", $crate::arg!() )
};
}
fn f() {
outer!();
//^^^^^^^^ could not resolve macro `$crate::arg`
} |
6751: Use the right `def_crate` for builtin macros r=jonas-schievink a=jonas-schievink Fixes the incorrect macro resolution in #6716 No test, because diagnostics do not get remapped correctly for some reason. I've checked manually that this fixes the resolution errors. bors r+ Co-authored-by: Jonas Schievink <[email protected]>
The resolution error should now be fixed. I'll look into the misplaced diagnostics later. |
Thanks @jonas-schievink! Is a new hotfix version going to be released? Or will this fix only be released on the next weekly release (6 days from now)? |
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. |
(the misplaced diagnostics are now also fixed) |
The misplaced diagnostics are now gone, but I still get a "failed to parse macro invocation" error with the latest nightly. This is doing a |
Same as @jeromegn , I am still getting the error on the nightly version of rust-analyzer, in my case in a call to |
I just compiled the |
Was this fixed with the latest stable release? |
Nope, still the same error message on the stable from yesterday. |
This is much better now, but I get "unresolved import" error when with |
@lnicola ok. This warning appeared in few days nightly build back. Maybe last week, so I got confused. |
The following code shows an error of "failed to parse or resolve macro invocation" in master bb69772
The text was updated successfully, but these errors were encountered: