Description
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)