Skip to content

Invalid macro fails only if used #21370

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

Closed
aochagavia opened this issue Jan 18, 2015 · 3 comments · Fixed by #22823
Closed

Invalid macro fails only if used #21370

aochagavia opened this issue Jan 18, 2015 · 3 comments · Fixed by #22823
Assignees
Labels
A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..)
Milestone

Comments

@aochagavia
Copy link
Contributor

The following code only produces an error when the macro is used. Compilation should actually fail even if the macro is never used.

macro_rules! test { ($wrong:t_ty) => () }

fn main() {
     //test!("hello world"); only causes an error if uncommented
}
@kmcallister kmcallister added the A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..) label Jan 18, 2015
@kmcallister
Copy link
Contributor

Yeah, it's my plan to move more of the macro_rules! parsing to the definition site (see #17616). I think that would improve the situation here.

@kmcallister
Copy link
Contributor

Nominating 1.0-beta, P-backcompat-lang

kmcallister added a commit to kmcallister/rust that referenced this issue Feb 26, 2015
Fixes rust-lang#21370.

unused-macro-with-follow-violation.rs was already handled correctly. That test
is just for good measure. :)
@pnkfelix
Copy link
Member

1.0-beta, P-backcompat-lang.

@pnkfelix pnkfelix added this to the 1.0 beta milestone Feb 26, 2015
Manishearth added a commit to Manishearth/rust that referenced this issue Feb 27, 2015
 Fixes rust-lang#21370.

`unused-macro-with-follow-violation.rs` was already handled correctly. That test is just for good measure. :)

I have a more involved plan to clean this up, but it ran into difficulties such as rust-lang#22814.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants