Merge pull request #555 from fhartwig/elision-fix

Fix another false positive in lifetime elision lint
This commit is contained in:
Manish Goregaokar 2016-01-17 23:15:05 +05:30
commit e2b1a050b1
2 changed files with 4 additions and 1 deletions

View File

@ -144,7 +144,6 @@ fn could_use_elision(cx: &LateContext, func: &FnDecl, slf: Option<&ExplicitSelf>
match (&input_lts[0], &output_lts[0]) { match (&input_lts[0], &output_lts[0]) {
(&Named(n1), &Named(n2)) if n1 == n2 => true, (&Named(n1), &Named(n2)) if n1 == n2 => true,
(&Named(_), &Unnamed) => true, (&Named(_), &Unnamed) => true,
(&Unnamed, &Named(_)) => true,
_ => false, // already elided, different named lifetimes _ => false, // already elided, different named lifetimes
// or something static going on // or something static going on
} }

View File

@ -119,5 +119,9 @@ fn alias_with_lt3<'a>(_foo: &FooAlias<'a> ) -> &'a str { unimplemented!() }
// no warning, two input lifetimes // no warning, two input lifetimes
fn alias_with_lt4<'a, 'b>(_foo: &'a FooAlias<'b> ) -> &'a str { unimplemented!() } fn alias_with_lt4<'a, 'b>(_foo: &'a FooAlias<'b> ) -> &'a str { unimplemented!() }
fn named_input_elided_output<'a>(_arg: &'a str) -> &str { unimplemented!() } //~ERROR explicit lifetimes given
fn elided_input_named_output<'a>(_arg: &str) -> &'a str { unimplemented!() }
fn main() { fn main() {
} }