Skip to content

Renamed lints not honored in attributes #82615

Closed
@ehuss

Description

@ehuss

I tried this code:

#![deny(single_use_lifetime)]
fn _foo<'a>(_x: &'a u32) {}

I expected to see this happen: Should generate an error due to the deny attribute.

Instead, this happened: Generates a warning about the renamed lint (single_use_lifetime -> single_use_lifetimes), but otherwise does not generate an error.

Note that lints passed on the command-line (like -D single_use_lifetime) do work as expected.

History

It looks like this behavior was broken in #43522 (first released in 1.21). It worked properly in 1.20. I don't see any discussion there about renaming, so I am assuming this was unintended. At the time, there was only one renamed lint (unknown_features -> unused_features), so I suspect there just wasn't much attention to it.

It looks like at various points there were attempts to add tests for these kinds of things (#30878 added the lint-renamed.rs test, which doesn't actually validate that the renamed lint works, just that it emits a warning).

Tested up to latest rustc 1.52.0-nightly (9c09c1f 2021-02-26)

Metadata

Metadata

Assignees

Labels

A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.C-bugCategory: This is a bug.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