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

#[macro use] should suggest #[macro_use] and similar #53411

Open
Havvy opened this issue Aug 15, 2018 · 0 comments
Open

#[macro use] should suggest #[macro_use] and similar #53411

Havvy opened this issue Aug 15, 2018 · 0 comments
Labels
A-diagnostics Area: Messages for errors, warnings, and lints A-suggestion-diagnostics Area: Suggestions generated by the compiler applied by `cargo fix`. C-enhancement Category: An issue proposing an enhancement or a PR with one. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@Havvy
Copy link
Contributor

Havvy commented Aug 15, 2018

I swapped an underscore for a space while typing out the attribute. It'd be nice if the error message said that instead of the mess it shows here:

error: expected identifier, found reserved keyword `macro`
 --> src/bin/factoid.rs:3:3
  |
3 | #[macro use]
  |   ^^^^^ expected identifier, found reserved keyword

error: cannot find macro `setup_panic!` in this scope
  --> src/bin/factoid.rs:13:5
   |
13 |     setup_panic!(Metadata {
   |     ^^^^^^^^^^^

error[E0658]: The attribute `r#macro` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642)
 --> src/bin/factoid.rs:3:1
  |
3 | #[macro use]
  | ^^^^^^^^^^^^

error: expected one of `(` or `=`, found `use`
 --> src/bin/factoid.rs:3:9
  |
1 | extern crate clap;
  | - expected one of `(` or `=` here
2 | extern crate exitcode;
3 | #[macro use]
  |         ^^^ unexpected token

This should also happen for all the other macros with underscores in them:

  • crate_name
  • crate_type
  • no_builtins
  • no_main
  • no_start
  • no_std
  • recursion_limit
  • windows_subsystem
  • no_implicit_prelude
  • link_args
  • linked_from
  • link_name
  • macro_use
  • macro_reexport
  • macro_export
  • no_link
  • export_name
  • no_mangle
  • link_section
  • cfg_attr
  • must_use
@Havvy Havvy added the A-diagnostics Area: Messages for errors, warnings, and lints label Aug 27, 2018
@JohnTitor JohnTitor added C-enhancement Category: An issue proposing an enhancement or a PR with one. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. A-suggestion-diagnostics Area: Suggestions generated by the compiler applied by `cargo fix`. labels Oct 19, 2019
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-suggestion-diagnostics Area: Suggestions generated by the compiler applied by `cargo fix`. C-enhancement Category: An issue proposing an enhancement or a PR with one. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

2 participants