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

#![crate_id="x"] attribute emits false (and useless) root module warning #43142

Closed
pnkfelix opened this issue Jul 10, 2017 · 0 comments · Fixed by #64471
Closed

#![crate_id="x"] attribute emits false (and useless) root module warning #43142

pnkfelix opened this issue Jul 10, 2017 · 0 comments · Fixed by #64471
Labels
A-diagnostics Area: Messages for errors, warnings, and lints C-enhancement Category: An issue proposing an enhancement or a PR with one.

Comments

@pnkfelix
Copy link
Member

(Spawned off of issue #43106)

Compiling this code (in stable/beta/nightly) results in the following compiler warnings:

#![crate_id = "x"]
fn main() { }

warnings:

warning: unused attribute
 --> <anon>:1:1
  |
1 | #![crate_id = "x"]
  | ^^^^^^^^^^^^^^^^^^
  |
  = note: #[warn(unused_attributes)] on by default

warning: crate-level attribute should be in the root module
 --> <anon>:1:1
  |
1 | #![crate_id = "x"]
  | ^^^^^^^^^^^^^^^^^^

The first warning is legitimate, since we killed off #![crate_id] back in RFC 109. The fact that it exists as an attribute in the code base is probably for backwards compatibility.

  • (The fact that it still has occurrences in the run-pass test suite is less explicable, since it should have no effect in the current rustc...)

The second warning is quite confusing, since the attribute is in the root module.

Can we easily kill off the second warning in this case?

@Mark-Simulacrum Mark-Simulacrum added the A-diagnostics Area: Messages for errors, warnings, and lints label Jul 19, 2017
@Mark-Simulacrum Mark-Simulacrum added the C-enhancement Category: An issue proposing an enhancement or a PR with one. label Jul 26, 2017
@bors bors closed this as completed in 3e4c778 Sep 15, 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 C-enhancement Category: An issue proposing an enhancement or a PR with one.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants