You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
"approximate check" for outlives relations can miss matches #54572
Per this comment, the current system for handling outlives obligations relies on an "approximate" match for outlives relations that is actually kind of flawed in some edge cases, which can lead to us overconstraining inference:
It's not really meant to be conservative in "two dimensions". That is, projection_approx_declared_bounds_from_env ought to return anything that might potentially be useful. I suspect this is not presently true, though, around bound regions and a few other edge cases (e.g., I think we by and large ignore things like for<'a> T::Proj<'a>: 'a, which is really a bug, although a pre-existing one; we also are too conservative I think around equality of types like for<'a> fn(&'a u32) vs for<'b> fn(&'b u32). Also a pre-existing bug.)
I might be able to fix those cases where we are "overly" conservative though via a more thorough erasure. I think erasing regions today preserves the lifetime bounds, but we would ideally look for an "equality" check that just completely ignores region equality (even around binders). I was working towards that but never finished it.
Originally, I had intended to fix this by using the "type relation" code from the NLL type checker, but in a mode where it ignored all the outlives relations. I introduced the idea of an "outlives delegate" and so forth in preparation for that but then never took the last step, since "erasing obligations" seemed simpler and sufficient for the moment.
SInce this is about getting "valid code" to compile, tagging as NLL-complete. But @nikomatsakis notes that it does not feel that urgent, so we're also tagging as NLL-deferred.
I believe the work intended here was implemented in #98109. We now support where for<'a> T::Proj<'a>: 'a and we have equality around binders via the test_type_match machinery.
Activity
pnkfelix commentedon Oct 2, 2018
SInce this is about getting "valid code" to compile, tagging as NLL-complete. But @nikomatsakis notes that it does not feel that urgent, so we're also tagging as NLL-deferred.
pnkfelix commentedon Dec 21, 2018
Re-triaging for #56754. P-low.
aliemjay commentedon Mar 2, 2023
I believe the work intended here was implemented in #98109. We now support
where for<'a> T::Proj<'a>: 'aand we have equality around binders via thetest_type_matchmachinery.Close?
aliemjay commentedon May 1, 2023
Closing as fixed in #98109.