-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
Regression in error message quality for macro_rules involving $:ident #69604
Comments
It still points to the specific problematic identifier 7 | nothing_expected!($ident);
| ^^^^^^ no rules expected this token in macro call , and now it's "in context", closer to the source of the syntax error. Another case to illustrate the change // Code
macro_rules! m { ($i: ident) => {
struct S $i
}}
m!(i);
fn main() {}
, the "after" variant looks better to me. |
@petrochenkov that's true if the macro definition is in the same crate. If it's from a different crate like in dtolnay/tt-call@364468e, all you see is an error on the entire invocation: |
5 | m!(i);
| ^^^^^^ This is less helpful particularly if there are many equal I think I am on board with the change for local macros but would prefer to have the old behavior for external macros. For external macros I think it will be better to steer toward localizing the macro expansion error as much as possible within a potentially large input, even if some external macro rule (which does not get shown in the diagnostic) may be "more at fault". |
would be good to know when this was injected. tagging E-needs-bisect. |
triage: needs-bisect. Prioritizing as P-medium, based on assumption that the quality of diagnostics here can regress slightly and then get fixed in a future release if need be. |
Between nightly-2020-02-28 and nightly-2020-02-29 I observed that macro errors which used to point to a specific problematic identifier token now point equivocally to the entire macro invocation. See dtolnay/tt-call@364468e.
The issue minimizes to:
Before; points to
T
:After; does not point to
T
:The applicable commit range is 6d69cab...0eb878d.
The most relevant looking PR in that range is #69384. @petrochenkov @Centril
The text was updated successfully, but these errors were encountered: