-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Badly placed 'Unexpected end of macro invocation' when calling a macro with no arguments #26615
Comments
Mostly fixed in #27584, above test case still produces a slightly unexpected result on playpen nightly, but points to the correct line (just to the
|
There are still some pathological cases, for example with this file: fn main() {}
fn foo() {
for _ in 0..3 {
/*
some
code
here
*/
println!();
/*
some
code
here
*/
}
} The generated error (on nigthly playpen) is:
|
Both of theses examples probably have the same root cause: The "unexpected end of macro invocation" error apparently always reports the span of the outermost ast node which requires expansion. See this gist (playground) for some examples of which span is reported in different contexts. |
The situation seems to have improved in the latest nightly: now only nested macro invocations have an incorrect spam and not macro invocations inside of other expanded things. Updated gist (playground). |
Looking over some pr's since my last comment, the improvement probably happened as part of #28857. |
As noted above, non-nested macro invocations are now fixed, and those are tracked separately (#33871). Closing. |
When a macro that expects arguments is not passed any, the "unexpected end of macro invocation" message is placed at the start of the crate root file, instead of the invocation.
The text was updated successfully, but these errors were encountered: