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

Confusing error message on incorrect macro invocation #10106

Closed
kmcallister opened this issue Oct 27, 2013 · 1 comment
Closed

Confusing error message on incorrect macro invocation #10106

kmcallister opened this issue Oct 27, 2013 · 1 comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints A-syntaxext Area: Syntax extensions

Comments

@kmcallister
Copy link
Contributor

#[feature(macro_rules)];

macro_rules! mymacro(
    ($x:ident) => ( "foo" );
)

fn main() {
    println(mymacro!());
}
$ rustc --version
rustc 0.9-pre (a7453ad 2013-10-22 15:31:26 -0700)
host: x86_64-unknown-linux-gnu

$ rustc foo.rs
foo.rs:1:0: 1:0 error: Unexpected end of macro invocation
foo.rs:1 #[feature(macro_rules)];
         ^

The error is the missing argument to the mymacro!() invocation. The error caret should point there, not to the first line in the crate.

@huonw
Copy link
Member

huonw commented Jan 12, 2014

Dupe of #7970.

@huonw huonw closed this as completed Jan 12, 2014
flip1995 pushed a commit to flip1995/rust that referenced this issue Jan 27, 2023
Fix FP in `unnecessary_safety_comment`

Fix rust-lang/rust-clippy#10084

changelog: FP: [`unnecessary_safety_comment`]: No longer lints code inside macros
[rust-lang#10106](rust-lang/rust-clippy#10106)
<!-- changelog_checked -->
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

No branches or pull requests

2 participants