pub static ELIDED_LIFETIMES_IN_ASSOCIATED_CONSTANT: &Lint
Expand description

The elided_lifetimes_in_associated_constant lint detects elided lifetimes that were erroneously allowed in associated constants.

Example

#![deny(elided_lifetimes_in_associated_constant)]

struct Foo;

impl Foo {
    const STR: &str = "hello, world";
}

{{produces}}

Explanation

Previous version of Rust

Implicit static-in-const behavior was decided against for associated constants because of ambiguity. This, however, regressed and the compiler erroneously treats elided lifetimes in associated constants as lifetime parameters on the impl.

This is a future-incompatible lint to transition this to a hard error in the future.