Skip to content
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

Span of macro variables points one token too early #15640

Closed
huonw opened this issue Jul 13, 2014 · 0 comments · Fixed by #19430
Closed

Span of macro variables points one token too early #15640

huonw opened this issue Jul 13, 2014 · 0 comments · Fixed by #19430
Labels
A-diagnostics Area: Messages for errors, warnings, and lints

Comments

@huonw
Copy link
Member

huonw commented Jul 13, 2014

#![feature(macro_rules)]

macro_rules! foo { () => { ($e) } }

foo!{}
macro-variable.rs:3:28: 3:29 error: unknown macro variable `e`
macro-variable.rs:3 macro_rules! foo { () => { ($e) } }
                                               ^

and if the RHS of the macro is changed to just => { $e }

macro-variable.rs:1:1: 1:1 error: unknown macro variable `e`
macro-variable.rs:1 #![feature(macro_rules)]
                    ^

Preferably this would put the error snake under the whole $... expression too.

pczarn added a commit to pczarn/rust that referenced this issue Jan 6, 2015
Prevents breaking down `$name` tokens into separate `$` and `name`.
Reports unknown macro variables.

Fixes rust-lang#18775
Fixes rust-lang#18839
Fixes rust-lang#15640
dlrobertson pushed a commit to dlrobertson/rust that referenced this issue Nov 29, 2018
Prevents breaking down `$name` tokens into separate `$` and `name`.
Reports unknown macro variables.

Fixes rust-lang#18775
Fixes rust-lang#18839
Fixes rust-lang#15640
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant