rust-lang / rust

Empowering everyone to build reliable and efficient software.
https://www.rust-lang.org
Other
98.15k stars 12.69k forks source link

fix false negatives in explicit_outlives_requirements #54630

Open zackmdavis opened 6 years ago

zackmdavis commented 6 years ago

Niko Matsakis points out that the explicit_outlives_requirements lint (from #53013, expected to land soon) should also fire on lifetime-outlives bounds and associated-type-outlives bounds, as illustrated by the following two examples:

struct Foo<'a, 'b: 'a> {
    x: &'a &'b u32
}

struct Bar<'a, T: Iterator> where T::Item: 'a {
    item: &'a T::Item,
}
fmease commented 5 months ago

We do emit explicit_outlives_requirements for the first case — Foo — (if the lint level is set to at least warn, ofc)but we still don't for the second case — Bar.