2023-10-27 rustc trait system refactor update

    for 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.

The last month was fairly involved. Ended up travelling to Brussels for the types team meetup where we discussed the stabilization of the new solver in coherence. There was no major disagreement and I continue to be confident that we can stabilize it during the next few months.

After the meetup I started to catch up on my notifications again and then continued to work on trait-system-refactor-initiative#1. More generally, I am trying to change our approach to alias-relate. When relating two aliases, we currently assemble 3 candidates: normalize lhs to rhs, normalize rhs to lhs, and relating the generic arguments of the aliases directly. This does not feel ideal performance-wise. I opened trait-system-refactor-initiative#68 for a hang in the new solver.

I am curently experimenting with an alternative approach: normalize lhs and rhs as much as possible, and then simply equate them. The actual implementation is not as trivial, mostly due to opaque types. Surprisingly, my current WIP attempt is slower than the existing approach. There is still a bunch of work I have to do here.

I also mostly fixed the generalization of aliases, handling with the biggest issue from trait-system-refactor-initiative#8. This fixes a coherence unsoundness in the old solver as well (#105787), so #117088 is still waiting on a crater run and an Types Team FCP.

There have also been some smaller improvements to the new solver: merged PRs.

if you find any typos or errors in this post, please pm me on zulip, discord or cohost


impressum rss