Skip to content

unused-lifetimes lint false-positives with async functions #61115

Closed
@Seeker14491

Description

@Seeker14491

Async functions that take references seem to always trigger the unused-lifetimes lint (which is allow-by-default). Example:

#![feature(async_await)]

#![warn(unused_lifetimes)]

pub async fn print(s: &str) {
    println!("{}", s);
}
warning: lifetime parameter `'_` never used
 --> src/lib.rs:5:23
  |
5 | pub async fn print(s: &str) {
  |                       ^
  |

Metadata

Metadata

Assignees

Labels

A-async-awaitArea: Async & AwaitA-lifetimesArea: Lifetimes / regionsA-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.AsyncAwait-PolishAsync-await issues that are part of the "polish" areaAsyncAwait-TriagedAsync-await issues that have been triaged during a working group meeting.C-bugCategory: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions