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

Unknown macro variables give "unexpected token" error, not an error that they are unknown #18839

Closed
huonw opened this issue Nov 10, 2014 · 0 comments · Fixed by #19430
Closed
Labels
A-diagnostics Area: Messages for errors, warnings, and lints A-syntaxext Area: Syntax extensions

Comments

@huonw
Copy link
Member

huonw commented Nov 10, 2014

#![feature(macro_rules)]

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

fn main() {
    foo!()
}
unknown-macro-variable.rs:3:29: 3:30 error: unexpected token: `$`
unknown-macro-variable.rs:3 macro_rules! foo { () => { $e }}
                                                        ^

This is very confusing and does not provide much help to work out what is wrong. (Looks like this was introduced by 38ce6d9.)

@huonw huonw added A-syntaxext Area: Syntax extensions A-diagnostics Area: Messages for errors, warnings, and lints labels Nov 10, 2014
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 A-syntaxext Area: Syntax extensions
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant