Open
Description
I discovered an unused lifetime in my code that the compiler didn't tell me about. I was able to reduce the problem to the following snippet.
#![warn(unused_lifetimes)]
struct Foo<'a>(for<'r> fn(&'r mut Foo<'a>));
impl<'a> Foo<'a> {
pub fn new() -> Self {
Self(Self::a)
}
pub fn a(&mut self) {}
}
fn main() {
let f = Foo::new();
drop(f);
}
The lifetime 'a is unused, but the compiler doesn't complain at all. I confirmed that it still exists on stable 1.44.1 and on nightly 1.46.0.