Incorrect unused_import
lint firing for a function-local macro_rules!
#78894
Closed
Description
I tried this code:
fn main ()
{
m!();
// where
macro_rules! m {
() => ();
} use m;
}
I expected to see this happen: no warning.
Instead, this happened: I get a warning saying:
warning: the item `m` is imported redundantly
--> src/main.rs:7:11
|
5 | / macro_rules! m {
6 | | () => ();
7 | | } use m;
| | - ^
| |_____|
| the item `m` is already defined here
|
= note: `#[warn(unused_imports)]` on by default
This is incorrect since removing that use
"statement" leads to the code not compiling.
Meta
Affects all three versions currently available in the Playground (1.47.0 -> 1.49.0)
Metadata
Assignees
Labels
Area: Messages for errors, warnings, and lintsArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)Category: This is a bug.Diagnostics: A diagnostic that is giving misleading or incorrect information.Call for participation: Help is requested to fix this issue.Call for participation: An issue has been fixed and does not reproduce, but no test has been added.Relevant to the compiler team, which will review and decide on the PR/issue.
Activity