Skip to content

Suggestion: Syntax errors for malformed extern statements could be clearer #25468

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
Wilfred opened this issue May 16, 2015 · 0 comments · Fixed by #25487
Closed

Suggestion: Syntax errors for malformed extern statements could be clearer #25468

Wilfred opened this issue May 16, 2015 · 0 comments · Fixed by #25487

Comments

@Wilfred
Copy link
Contributor

Wilfred commented May 16, 2015

This is a very minor bit of polish, but I bumped into it. Given the following syntactically invalid code:

extern crte hyper;

fn main() {
    println!("hello world")
}

rustc produces the error:

$ rustc foo.rs
foo.rs:1:8: 1:12 error: expected `{` or `fn`, found `crte`
foo.rs:1 extern crte hyper;
                ^~~~

Ideally, the syntax error message would suggest crate in this instance too.

Whilst there are other tokens that can occur after extern (such as strings), I think crate is sufficiently common to warrant an explicit mention.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant