What is the latest on the chalkification of rust?

I haven’t had the pleasure of using rust in a long time now (been too busy programming in other languages) but I would like to stay in the loop on major rust news.
I see that GATs are coming close now. What about chalk? Is that making steady progress? I kind of got the impression chalk is soaking up a lot of brain power among people who make rust. But I also got the impression that it will make the compiler easier to reason about and thus easier to roll out new features. Any interesting recent news on this?

8 Likes

If we're at it, I'd like to ask about Polonius too.

5 Likes

So, there's a lot of moving bits here. First and foremost, I posted a few summaries on the traits working group sprints from early last year on the Inside Rust blog. The latest from last July (gosh time flies) is here: Traits working group 2020 sprint 3 summary | Inside Rust Blog. Those include Chalk related goals. But yeah, they're a bit dated now. So here's a few general points/summary:

  • There's an experimental integration in rustc under the -Z chalk flag. I think last time I checked, only about 1/2 to 2/3 of the rustc test suite passes, so still lots to do, but there is a lot that does.
  • There are couple key design differences between rustc and Chalk that need to be addressed before Chalk gets full integration (right now, we have a very heavy "translation" like layer). One of the bigger ones was that rustc doesn't track the bound vars that can occur in types; but, I fairly recently completed a refactor that took about 6 months that moves rustc closer to Chalk. There are a couple of other big things like the concept of Params in rustc, placeholder canonicalization, late bound vs early bound regions.
  • Part of the Chalk effort is to move Chalk and rustc to have a unified "type library" and incremental progress is being made here. There are some challenges around working with coherence and such when moving this out of the rustc_middle crate. But the eventual goal is that the same library that is used for rustc's type system can be used in Chalk, rust-analyzer, etc.
  • While Chalk has a lot there in terms of features, there still are features missing, such as specialization, and some bugs and design decisions to be made around some well-formedness rules (like around trait objects or functions) or associated type normalization (in the SLG solver).

Ultimately there's still lots more to do, but we're making incremental progress from several directions.

For Polonius, I can't really say, since I'm not involved there.

12 Likes