-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-lifetimesArea: Lifetimes / regionsArea: Lifetimes / regionsA-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.L-single_use_lifetimesLint: single_use_lifetimesLint: single_use_lifetimesT-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
Repro (on 1.27-stable to 1.31-nightly):
#![warn(single_use_lifetimes)]
pub trait Tfv<'a>: Sized {
fn tfv(x: &'a str) -> Option<Self>;
// fn shut_up_single_use_lifetimes(_: &'a ()) {} // uncomment to shut up the lint 😕
}
Unexpected lint result:
warning: lifetime parameter `'a` only used once
--> src/lib.rs:3:15
|
3 | pub trait Tfv<'a>: Sized {
| ^^ this lifetime...
4 | fn tfv(x: &'a str) -> Option<Self>;
| -- ...is used only here
|
cc #44752
Metadata
Metadata
Assignees
Labels
A-lifetimesArea: Lifetimes / regionsArea: Lifetimes / regionsA-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.L-single_use_lifetimesLint: single_use_lifetimesLint: single_use_lifetimesT-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.