I wrote a virtual machine in the Rust type system! (Why not.)
This is a follow-up to a CTF challenge I wrote. It is a small proof-of-concept virtual machine embedded in the Rust type system, which uses trait resolution and in particular associated types to "execute" a program, represented as a type, to its final state. (The "execution" happens during Rust compilation.)
The VM architecture is simple: two 8-bit registers, a stack, a small number of instructions, including conditional control flow. However, other than patience and hitting the recursion limits, more useful/realistic architectures could be embedded as well.
No, I didn't really run into (scary) bugs. The issue that was solved with -Znext-solver was the result of compiler checking some impl blocks too eagerly, even though they were not actually candidates for selection (if I understand it correctly). This is technically fine: it just disallows some programs that should actually type check, i.e., it is a completeness issue, not a soundness one.
Apart from that I thought I found a problem that caused the compiler to hang indefinitely, but as I note in the blog post, I think it's actually just that the time to perform the error reporting scales really badly with the number of (related) impl blocks.
Also cve-rs does not seem to be related to trait resolution, right?