Currently in #42669, we are handling only ConcreteFailure RegionResolution Errors. We need to detect and improve the error message for SubSupConflict Error as well.
struct Foo {
field: i32
}
impl Foo{
fn foo2<'a>(&self, x: &'a i32) -> &'a i32 {
if true { &self.field } else { x }
}
}
cc @nikomatsakis
I'd like to start working on this if noone else is assigned.
@cengizIO expressed some interest in taking a look at this. @cengizIO, here are some rough instructions for what would have to be done. Currently, when reporting region errors, we check for the special case of a "named-anon conflict". If you look into this function, you'll see that it first tests for ConcreteFailure. The basic task here is to extend that also work for SubSupConflict. I think, in this case, that is probably as easy as extracting the sub and sup regions involved (as well as the "main span") and returning them, and then checking what impact that has on the tests involved and making sure everything still looks ok. It's a good opportunity though to read over the code and understand what it does.
You can read up my blogs here. I hope they will be of help :)
Ping: I was busy with other stuff since I've signed up to this. Now that they are over, I'm diving into it.
I think this is a good test case:
struct Foo {
field: i32,
}
fn foo2<'a>(a: &'a Foo, x: &i32) -> &'a i32 {
if true {
let p: &i32 = &a.field;
&*p
} else {
&*x
}
}
fn main() { }
Hello @gaurikholkar I was in LOA during last week, just returned. Will revise my PR tomorrow.
I've removed the redundant test case and updated the sample input with the provided one up in https://github.com/rust-lang/rust/issues/42701#issuecomment-326091615
Most helpful comment
@cengizIO expressed some interest in taking a look at this. @cengizIO, here are some rough instructions for what would have to be done. Currently, when reporting region errors, we check for the special case of a "named-anon conflict". If you look into this function, you'll see that it first tests for
ConcreteFailure. The basic task here is to extend that also work forSubSupConflict. I think, in this case, that is probably as easy as extracting the sub and sup regions involved (as well as the "main span") and returning them, and then checking what impact that has on the tests involved and making sure everything still looks ok. It's a good opportunity though to read over the code and understand what it does.