2023-07-28 rustc trait system refactor updatefor more information, check out the implementation tracking issue #107374, or the Trait System Refactor Initiative Issue Tracker. These updates are from my perspective and are not the official stance of the initiative. They exist to bridge the gap between major progress updates via rust-lang blog posts and the passive status tracking via the tracking issue and the initiative GitHub repository.
We found some new issues/regressions:
- Inductive cycles are considered to not hold in the old solver while being ambiguous in the new one. We changed the behavior here as we want to treat more cycles as coinductive going forward, at which point goals with currently inductive cycles will hold. This change results in breakage found via crater (trait-system-refactor-initiative#50). It feels unavoidable as we have to move trait goals to be coinductive. It is necessary for many future type system extensions and improvements. It is also required to fix many known unsound issues. @compiler-errors has therefore implemented a future compat lint here (#114023)
- A crate depends on a coherence bug of the existing solver (#114061). The usage by the crate itself is sound, but requires additional support to keep working. We will either accept and fix the breakage in the affected crate or add an explicit negative impl of
&(): IntoIteratorto core, which should fix this regression.
- We also need to lazily normalize in
fn trait_ref_is_knowable. (trait-system-refactor-initiative#51). I intend to implement support for this in the near future.
Outside of coherence, I continued thinking about overflow and the global cache in the solver. I mostly just have to write down my thoughts now and get approval from the rest of the types team for my approach. This is a fairly impactful decision and also really subtle, so I have to make sure I didn’t miss anything. It did get me to spend more than an hour writing a test case. See this cohost post for what is probably my most involved discovery to date.
We were able to remove an unnecessary incompleteness for
alias-relate goals (#113901) and restored region uniquification (#114117). Both of these changes were possible due to
bidirectional-normalizes-to: a hack when proving
alias-relate goals which, in case of ambiguity, proves both
lhs normalizes-to rhs and
rhs normalizes-to lhs (trait-system-refactor-initiative#25).