2023-08-11 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.

We merged the new approach to overflow handling this week (#114287). I still have to open a PR adding a rustc-dev-guide section for this.

The check for stable evaluation results mentioned last week ended up triggering in my PR which adds lazy normalization to trait_ref_is_knowable (#114457). This caused me to discover a bug in my provisional cache implementation which I fixed in #114694. However, this fix causes a different bug. I was already aware of that issue as it also affects the old solver and chalk.

The simplest fix here is rip out the provisional cache entirely, only detecting cycles hitting a goal on the stack. This would negatively impact performance if there are very complex cycles. I don’t expect such goals to exist in the wild and expect its impact to be insignificant.

Alternatively, we can fix this by extending the implementation to store whether a result in the cache relied on its call stack being fully coinductive, and ignoring that result in case the current call stack is not. This is non-trivial and adds even more complexity to what is already the most involved part of the solver.

While I am personally in favor of ripping out the provisional cache to simplify the implementation, I want to wait for some additional input from other T-types members, most notably @nikomatsakis.

As always, this week also saw some smaller improvements and fixes. Check out the complete list of PRs merged this week to see more.

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

back

impressum rss