Skip to content

Regression of #53738: spurious single_use_lifetimes warning #69952

@stouset

Description

@stouset

Issue #53738 seems to have regressed.

I tried this code:

#[deny(single_use_lifetimes)]

#[derive(Eq)]
struct Foo<'a, T> {
    /// a reference to the underlying secret data that will be derefed
    pub data: &'a mut T,
}

I expected to see this happen: No warning should be produced.

Instead, this happened:

error: lifetime parameter `'a` only used once
 --> src/lib.rs:4:12
  |
3 | #[derive(Eq)]
  |          -- ...is used only here
4 | struct Foo<'a, T> {
  |            ^^ this lifetime...
  |
note: lint level defined here
 --> src/lib.rs:1:8
  |
1 | #[deny(single_use_lifetimes)]
  |        ^^^^^^^^^^^^^^^^^^^^

Meta

rustc --version --verbose:

rustc 1.42.0 (b8cedc004 2020-03-09)
binary: rustc
commit-hash: b8cedc00407a4c56a3bda1ed605c6fc166655447
commit-date: 2020-03-09
host: x86_64-apple-darwin
release: 1.42.0
LLVM version: 9.0

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.C-bugCategory: This is a bug.F-lint-single_use_lifetimes`single_use_lifetimes` lintICEBreaker-Cleanup-CrewHelping to "clean up" bugs with minimal examples and bisectionsP-mediumMedium priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions