Formal semanticsmodels Rust
MiniRust
An executable specification of what Rust programs do at run time, including exactly which unsafe operations are undefined behavior. It describes an idealized MIR-like core language that Rust is translated into.
MiniRust is written as an interpreter in "specr lang", a Rust-like pseudo-code that a tool (specr-transpile) turns into real Rust, so the specification can be run on test programs. A separate tool, minimize, translates real Rust programs (through rustc's MIR) into MiniRust. Type checking, trait resolution and borrow checking happen before MiniRust and are out of scope; a-mir-formality covers those. The README calls the project "extremely incomplete".
What it covers
- Models
- Rust, No Rust version is named; the minimize translator builds against rustc nightly-2026-05-01.
- Fragment
- Operational semantics only: evaluation order, data representation, pointers and provenance, and undefined behavior of a MIR-like core language. Traits and pattern matching are resolved before MiniRust, and type checking and borrow checking are out of scope. Floats are missing, and many operators and casts are not yet in the syntax. Two memory models are given: a basic one that ignores aliasing rules, and Tree Borrows.
- Written in
- specr lang (Rust-like pseudo-code, transpiled to Rust)
- Usable in
- —
- Validation
- A test suite of about 140 Rust programs (passing programs, panics and programs with undefined behavior) is translated with minimize and run on the MiniRust interpreter, comparing output with expected files. No published conformance or differential-testing results against rustc or Miri were found.
- Maintained by
- Ralf Jung and contributors (github.com/minirust)
Stage
Computed from the evidence below; see the criteria. MechanizedMechanized. Written in a form a computer can check, rather than on paper. means a computer can check the definition.
- Met: Machine-checked or machine-readable definition The specification is code in specr lang, which specr-transpile turns into Rust. It is not available in a proof assistant; the README hopes for a future translation to one. evidence
- Not met: Fragment and version are stated The README states the covered fragment and what is missing, but names no Rust version that the specification describes. evidence
- Met: Can be executed or tested The spec runs as an interpreter; minimize translates Rust programs (via MIR) into MiniRust and executes them. evidence
- Not met: Published results against conformance tests or real implementations Has a repository test suite with expected outputs, but no published validation results. evidence
- Not met: Adopted by the language or ISA owner, or covers the full current version and tracks new ones Adopted by the owner: no; full coverage: no; tracks new versions: no. Hosted outside the rust-lang organization. The README presents it as the author's vision for a normative specification, not an adopted one. The README says the specification is extremely incomplete (for example, no floats). No stated policy for following Rust releases. evidence
Coverage
Which parts of Rust the model defines.
Common features
| Feature | Support | Notes |
|---|---|---|
| Machine integers Fixed-width integer arithmetic, overflow and bit operations. | PartialPartial.Integer types and arithmetic, including overflow behavior, are modeled; the README says many operators and casts are still missing. Source | Integer types and arithmetic, including overflow behavior, are modeled; the README says many operators and casts are still missing. source |
| Floating point IEEE 754 floating-point arithmetic, including rounding and NaNs. | Not supportedNot supported.Floats are entirely missing (README); the type list has no float type. Source | Floats are entirely missing (README); the type list has no float type. source |
| Heap and pointers Dynamically allocated memory, pointers or references, and aliasing. | SupportedSupported.Pointers with provenance, allocation and deallocation, and integer-pointer casts, behind a byte-level memory interface. Source | Pointers with provenance, allocation and deallocation, and integer-pointer casts, behind a byte-level memory interface. source |
| Arrays and buffers Indexed memory such as arrays, slices, vectors and byte buffers. | SupportedSupported.Array and slice types. Source | Array and slice types. source |
| Loops Unbounded loops, which need invariants or bounds to verify. | SupportedSupported.Loops are control-flow jumps between basic blocks, as in MIR. Source | Loops are control-flow jumps between basic blocks, as in MIR. source |
| Recursion Functions that call themselves, directly or through others. | SupportedSupported. Source | source |
| Higher-order code Function pointers, closures and callbacks. | SupportedSupported.Function pointers are modeled; closures are turned into ordinary functions before MiniRust, and tests cover both. Source | Function pointers are modeled; closures are turned into ordinary functions before MiniRust, and tests cover both. source |
| Threads and shared memory Concurrent threads with locks, atomics or message passing. | PartialPartial.Threads (spawn and join), locks and atomic operations with data-race detection exist, but only sequentially consistent atomics; the spec says atomicity is otherwise ignored for now. Source | Threads (spawn and join), locks and atomic operations with data-race detection exist, but only sequentially consistent atomics; the spec says atomicity is otherwise ignored for now. source |
| I/O and system calls Files, network, system calls and foreign-function calls. | PartialPartial.Printing to stdout and stderr and exiting are built-in operations; there is no file or network I/O. Source | Printing to stdout and stderr and exiting are built-in operations; there is no file or network I/O. source |
| Standard library Specifications or models for the language's standard library. | UnknownUnknown.The spec defines no standard library; minimize translates the standard-library code a program uses, and how much of it works is not documented. | The spec defines no standard library; minimize translates the standard-library code a program uses, and how much of it works is not documented. |
Rust-specific features
| Feature | Support | Notes |
|---|---|---|
| References and borrowing Shared and mutable references checked by the borrow checker. | PartialPartial.References are pointers whose aliasing rules are modeled by the optional Tree Borrows memory model. Borrow checking itself happens before MiniRust and is out of scope. Source | References are pointers whose aliasing rules are modeled by the optional Tree Borrows memory model. Borrow checking itself happens before MiniRust and is out of scope. source |
| Traits and generics Generic functions and types with trait bounds. | Not applicableNot applicable.Traits are resolved during translation to MiniRust; dynamic dispatch is covered under trait objects. Source | Traits are resolved during translation to MiniRust; dynamic dispatch is covered under trait objects. source |
| Closures Anonymous functions that capture their environment. | SupportedSupported.Closures are desugared before MiniRust; tests cover them. Source | Closures are desugared before MiniRust; tests cover them. source |
| unsafe and raw pointers Code inside unsafe blocks, raw pointer dereferences and FFI. | SupportedSupported.Unsafe operations and exactly when they are undefined behavior are the main subject of the specification. Source | Unsafe operations and exactly when they are undefined behavior are the main subject of the specification. source |
| Interior mutability Cell, RefCell, UnsafeCell and other mutation through shared references. | SupportedSupported.Covered by the Tree Borrows model, with tests for cells inside structs and slices. Source | Covered by the Tree Borrows model, with tests for cells inside structs and slices. source |
| Trait objects dyn Trait values with dynamic dispatch. | SupportedSupported.Trait-object types and vtable pointers are part of the type system. Source | Trait-object types and vtable pointers are part of the type system. source |
| Iterators Iterator chains such as map, filter and for loops over collections. | SupportedSupported.Iterators are ordinary code after translation; tests cover them. Source | Iterators are ordinary code after translation; tests cover them. source |
| Panics Panicking operations (unwrap, indexing, overflow in debug builds) and their absence. | SupportedSupported.Unwinding, cleanup blocks and catching panics are modeled. Source | Unwinding, cleanup blocks and catching panics are modeled. source |
| async / await Asynchronous functions and futures. | UnknownUnknown.Not mentioned in the specification or tests. | Not mentioned in the specification or tests. |
Used by
Toolchains in this index whose proofs are about this model.
No toolchain in the index refers to it yet.
Sources
- MiniRust README · accessed 26 Nov 2026
- MiniRust tooling (minimize, minitest) · accessed 26 Nov 2026
- Pinned rustc nightly for minimize · accessed 26 Nov 2026