Many people want to know, precisely, which pieces of text are valid Rust programs, and for those that are, what they do. This group includes compiler writers, language designers, researchers, unsafe code writers, safety-critical industry assessors, and of course any Rust developer trying to understand a piece of code.
In a recent post, I touched upon the "contexts and capabilities" feature idea; after more thought and exciting discussions with Boxy, Jana and others, there's a bullet we're tempted to bite: what if we just used plain old trait bounds?
Rust is very liberal in how it allows items (types, traits, functions, ...) to depend on each other and even themselves. This delightful expressiveness comes at a cost: our lack of guardrails on recursion in the trait system is the source of a number of soundness bugs today.
A common way to define equality in type theories, attributed to Per Martin-Löf, is as follows: a == b is a type with two parameters a and b, and it has a single constructor refl x with type x == x.
This article is part of an collaboration with the Rust Types team where we're looking into integrating these ideas into the Rust compiler to make it more robust and more correct. I'm like babby in the realm of trait solving internals, expect this to be directionally right but missing some important caveats.
The heart of Rust borrow-checking is this: when a borrow is taken, and until it expires, access to the borrowed place is restricted. For example you may not read from a place while it is mutably borrowed.
In a recent meeting, Niko proposed that we should add language features to enable desugaring more implicit things into valid Rust. This blog post is me taking his idea and running with it. Edit: I have turned this idea into a book! This book describes ~30 desugaring steps that go from surface Rust to a MIR-like subset of it. I intend this to be a reference document or even a spec kind of thing. Do…
This blog post is part of the discussions around the Field Projections project goal. Thanks to Benno Lossin and everyone involved for the very fruitful discussions!
Postfix macros is the feature proposal that would allow something.macro!(x, y, z). It's been stalled for a long time on some design issues; in this blog post I'm exploring an idea that could answer these issues.