-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
Should importing a #[macro_export] macro_rules! macro trigger unused_imports? #147823
Copy link
Copy link
Open
Labels
A-decl-macros-1-2Area: Declarative macros 1.2Area: Declarative macros 1.2A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.Area: Lints (warnings about flaws in source code) such as unused_mut.A-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..)C-discussionCategory: Discussion or questions that doesn't represent real issues.Category: Discussion or questions that doesn't represent real issues.L-unused_importsLint: unused_importsLint: unused_importsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.T-langRelevant to the language teamRelevant to the language team
Metadata
Metadata
Assignees
Labels
A-decl-macros-1-2Area: Declarative macros 1.2Area: Declarative macros 1.2A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.Area: Lints (warnings about flaws in source code) such as unused_mut.A-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..)C-discussionCategory: Discussion or questions that doesn't represent real issues.Category: Discussion or questions that doesn't represent real issues.L-unused_importsLint: unused_importsLint: unused_importsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.T-langRelevant to the language teamRelevant to the language team
Type
Fields
Give feedbackNo fields configured for issues without a type.
I tried this code:
On stable,
cargo checkcompletes successfully. On Nightly, it produces a warning:Nightly is correct in the sense that the import is, in fact, unnecessary, and the code builds with or without it. But I’m not sure whether this is a bug or not. I always put the import in because I like to think about modules and don’t like to think about the arcane
macro_rules!scoping rules, but given that I can’t disable those rules this might be a losing battle…Meta
rustc --version --verbose:rustc +nightly --version --verbose: