Skip to content

single_use_lifetimes warns when deriving a struct #53738

Description

@TimDiekmann

When compiling

#![warn(single_use_lifetimes)]

#[derive(Debug)]
struct Foo<'a> {
    bar: &'a u32,
}

this warning is generated:

warning: lifetime parameter `'a` only used once
 --> src/lib.rs:5:12
  |
5 | struct Foo<'a> {
  |            ^^
  |

I think, #[automatically_derived] in the Debug derive does not consider this lint.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

A-edition-2018Area: The 2018 editionA-lifetimesArea: Lifetimes / regionsA-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.P-mediumMedium priorityT-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