Closed
Description
I tried this code:
#![warn(unused_lifetimes)]
pub struct Thingy<'x, X> {
x: &'x mut X,
y: &'static str,
}
impl<'x, X> Thingy<'x, X> {
pub fn new(x: &'x mut X) -> Self {
Self{x, y: "hello"}
}
pub async fn foo(&mut self) -> &'static str {
self.y
}
}
I got a warning “lifetime parameter 'x
never used”, on the impl
line. But it clearly is used. The warning goes away if I delete the function foo
, or make it a regular function instead of an asynchronous function.
Meta
rustc --version --verbose
:
rustc 1.46.0
binary: rustc
commit-hash: unknown
commit-date: unknown
host: x86_64-unknown-linux-gnu
release: 1.46.0
LLVM version: 10.0
I saw #61115 and rust-lang/rust-clippy#3988, but those were both closed at least a year ago and this is still happening in 1.46.0 which was just released recently, so I assume it’s not the same bug.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Done