Closed
Description
Hello!
(this shall be considered an item under #42516)
While me and @nikomatsakis were working on #42701 we've discovered that this case is not handled properly. (properly: didn't use new lifetime error messages)
struct Foo {
field: i32,
}
fn foo2<'a, 'b>(a: &'a Foo, x: &'b i32) -> &'a i32 {
if true {
let p: &i32 = &a.field;
&*p
} else {
&*x
}
}
fn main() {}
This currently shows a error[E0495]: cannot infer an appropriate lifetime for borrow expression due to conflicting requirements
. It should show one of the E06XX
errors instead.
@nikomatsakis said that fix might be dependent on this: #44124
So, this issue is a reminder for us to fix that case. Any help is more than welcome!
🍻