Description
This issue tracks error compatibility with the current version of rustc
for functions involving HRTBs. This is one of the major features missing from Polonius.
Currently, rustc
uses the concept of Universes (described in detail here to reason about HRTBs. Previously, it used something called the leak check, which I believe still exists in some form.
rustc
implementation history (possibly incomplete):
- Universes rust#55517
- Re-implement leak check in terms of universes rust#58592
- replace the leak check with universes, take 2 rust#65232
- extend NLL checker to understand
'empty
combined with universes rust#70950 - MCP notes
Relevant test cases (definitely incomplete):
- ICE related to lifetimes and traits rust#58451
- Regression in trait bounds that are redundant with associated type's HRTB rust#57639
Currently, Polonius cannot handle quantified constraints arising from HRTBs. One possible framework, hereditary-harrop predicates, were explored in Niko's blog post. I discussed the implications of allowing a reduced set of these (just the quantifiers) in a later post.
For now, the goal is simply to reach feature parity with current versions of rustc
, but the rustc
borrow-checker has some shortcomings around HRTBs, where it needs to represent constraints like for <'a, 'b: 'a>
, and there are some upcoming features that may complicate things further: