Rust's new trait solver finally ships in 1.102.0 after a decade of work

Optimizing Rustc's next trait solver

Rust's new trait solver finally ships in 1.102.0 after a decade of work

After eleven years of development — starting with the Chalk project in 2015 and becoming an official compiler effort in 2022 — Rust's next-generation trait solver lands in Rust 1.102.0. Performance was the last major blocker before stabilization. The author, who spent a year full-time optimizing it, explains from scratch what a trait solver is, why it resembles a Prolog interpreter, and why even answering "is this type Sized?" happens roughly 800,000 times when compiling the standard library.

We now call this project "project zero", referring to the number of soundness bugs we'd ideally like to have in our type system.
  1. cbarrick

    Nit: "et cetera" is two words.

    It is a latin phrase that literally translates to "and the rest." "Et" means "and," and "cetera" means "the rest."

    This is a great article! Apologies for being pedantic. I'm just noting this fun fact here in case the author is checking this thread.

  2. cogman10

    I was curious to figure out exactly why the new trait solver was needed.

    Apparently it's easier to work with and more correct. Future type system changes are blocked on it. These 2 in particular were called out as being blocked by the new trait solver [1]

    [1] https://goals.rust-lang.org/2026/rtn.html

  3. AlotOfReading

    It's interesting how much of the next gen compiler improves borrow heavily from logic programming. I don't know if any other compilers that have made the connection to logic programming as explicit as rustc.

  4. ozgrakkurt

    Rust compilation is impossible to solve for some reason.

    I have a 4k line project that depends on serde-json, xxhash, crossbeam and rand.

    It takes several seconds to compile in release mode.

    This is insane compared to my 20k line project in C++ which compiles everything and runs all tests in 0.7 seconds.

    The C++ project doesn't depend on libc or any external libraries but that is not a practical option in rust.

    I tried bunch of different options and actually removed some dependencies but it seems like it is not possible to get the rust program to compile fast.

    Does anyone know why it is this slow comparatively?

  5. eosis

    Awesome work, seems an odyssey.

    I think there is a little error in the code snippets near the caching section start where it claims variables are swapped but they are not? Though maybe I have just misunderstood something.

More from this day

2026-11-29