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

inner attribute syntax issue #49040

Closed
liigo opened this issue Mar 15, 2018 · 1 comment
Closed

inner attribute syntax issue #49040

liigo opened this issue Mar 15, 2018 · 1 comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints C-enhancement Category: An issue proposing an enhancement or a PR with one.

Comments

@liigo
Copy link
Contributor

liigo commented Mar 15, 2018

#![allow(unused_variables)]; // note: a tailing semicolon here

fn main() {}

Stable & Nightly compiler error:

warning: this inner attribute syntax is deprecated. The new syntax is `#![foo]`, with a bang and no semicolon
 --> src/main.rs:1:1
  |
1 | #![allow(unused_variables)];
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^

I think I already use the "new syntax", except adding one more semicolon.
The compiler could simply suggest me removing the redundant semicolon.

@petrochenkov
Copy link
Contributor

It already suggests it.

The new syntax is #![foo], with a bang and no semicolon

That said, the message can be improved by not mentioning deprecation (the old syntax was removed long time ago) and adding a suggestion/label pointing to the semicolon.

@estebank estebank added C-enhancement Category: An issue proposing an enhancement or a PR with one. A-diagnostics Area: Messages for errors, warnings, and lints labels Mar 15, 2018
kennytm added a commit to kennytm/rust that referenced this issue Mar 19, 2018
improve error message of inner attribute syntax

Fixes rust-lang#49040
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 C-enhancement Category: An issue proposing an enhancement or a PR with one.
Projects
None yet
Development

No branches or pull requests

3 participants