-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.Area: Lints (warnings about flaws in source code) such as unused_mut.C-bugCategory: This is a bug.Category: This is a bug.T-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.
Description
The new lint for excess semicolons (#62984) has some weird behaviour when the lint is triggered inside an async function that is transformed using a procedural macro.
Rustc version: 1.39.0-nightly (9b91b9c 2019-08-26)
Compiling this:
#[tokio::main]
async fn main() -> Result<(), ()> {
let mut workers = 5;;
Ok(())
}
gives this output:
warning: unused variable: `workers`
--> examples/test.rs:1:1
|
1 | #[tokio::main]
| ^ help: consider prefixing with an underscore: `_workers`
|
= note: `#[warn(unused_variables)]` on by default
warning: variable does not need to be mutable
--> examples/test.rs:1:1
|
1 | #[tokio::main]
| ^ help: remove this `mut`
|
= note: `#[warn(unused_mut)]` on by default
note how the spans are all targeting the procedural macro instead of the correct line.
If I remove the procedural macro or if I remove the excess semicolon, the spans are fine. This leads me to believe that it's an error in the lint, not in the macro, but maybe I'm wrong.
Metadata
Metadata
Assignees
Labels
A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.Area: Lints (warnings about flaws in source code) such as unused_mut.C-bugCategory: This is a bug.Category: This is a bug.T-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.