# 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".

- Kind: formal semantics
- 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)
- Available in: —
- Stage: not yet staged
- Licence: open-source, Apache-2.0 and MIT license files
- 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.
- Latest release: main@d55ab41 (2026-11-26) https://github.com/minirust/minirust/commits/master

## Stage

**Stage —: Not yet staged.**

| Stage | Criterion | Met | Evidence / note |
|---|---|---|---|
| 0 | Machine-checked or machine-readable definition | yes | [evidence](https://github.com/minirust/minirust/blob/master/README.md) 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. |
| 0 | Fragment and version are stated | no | [evidence](https://github.com/minirust/minirust/blob/master/README.md) The README states the covered fragment and what is missing, but names no Rust version that the specification describes. |
| 1 | Can be executed or tested | yes | [evidence](https://github.com/minirust/minirust/blob/master/tooling/README.md) The spec runs as an interpreter; minimize translates Rust programs (via MIR) into MiniRust and executes them. |
| 1 | Published results against conformance tests or real implementations | no | [evidence](https://github.com/minirust/minirust/tree/master/tooling/minimize/tests) Has a repository test suite with expected outputs, but no published validation results. |
| 2 | Adopted by the language or ISA owner, or covers the full current version and tracks new ones | no | [evidence](https://github.com/minirust/minirust/blob/master/README.md) 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. |

Missing for Stage 0: Fragment and version are stated.

## Common features

| Feature | Coverage |
|---|---|
| Machine integers | Partial — Integer types and arithmetic, including overflow behavior, are modeled; the README says many operators and casts are still missing. ([source](https://github.com/minirust/minirust/blob/master/README.md)) |
| Floating point | Not supported — Floats are entirely missing (README); the type list has no float type. ([source](https://github.com/minirust/minirust/blob/master/spec/lang/types.md)) |
| Heap and pointers | Supported — Pointers with provenance, allocation and deallocation, and integer-pointer casts, behind a byte-level memory interface. ([source](https://github.com/minirust/minirust/blob/master/spec/mem/interface.md)) |
| Arrays and buffers | Supported — Array and slice types. ([source](https://github.com/minirust/minirust/blob/master/spec/lang/types.md)) |
| Loops | Supported — Loops are control-flow jumps between basic blocks, as in MIR. ([source](https://github.com/minirust/minirust/blob/master/spec/lang/syntax.md)) |
| Recursion | Supported ([source](https://github.com/minirust/minirust/blob/master/spec/lang/syntax.md)) |
| Higher-order code | Supported — Function pointers are modeled; closures are turned into ordinary functions before MiniRust, and tests cover both. ([source](https://github.com/minirust/minirust/tree/master/tooling/minimize/tests/pass)) |
| Threads and shared memory | Partial — 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](https://github.com/minirust/minirust/blob/master/spec/mem/concurrent.md)) |
| I/O and system calls | Partial — Printing to stdout and stderr and exiting are built-in operations; there is no file or network I/O. ([source](https://github.com/minirust/minirust/blob/master/spec/lang/step/intrinsics.md)) |
| Standard library | Unknown — 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 | Coverage |
|---|---|
| References and borrowing | Partial — 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](https://github.com/minirust/minirust/tree/master/spec/mem/tree_borrows)) |
| Traits and generics | Not applicable — Traits are resolved during translation to MiniRust; dynamic dispatch is covered under trait objects. ([source](https://github.com/minirust/minirust/blob/master/README.md)) |
| Closures | Supported — Closures are desugared before MiniRust; tests cover them. ([source](https://github.com/minirust/minirust/tree/master/tooling/minimize/tests/pass)) |
| unsafe and raw pointers | Supported — Unsafe operations and exactly when they are undefined behavior are the main subject of the specification. ([source](https://github.com/minirust/minirust/blob/master/README.md)) |
| Interior mutability | Supported — Covered by the Tree Borrows model, with tests for cells inside structs and slices. ([source](https://github.com/minirust/minirust/tree/master/tooling/minimize/tests/pass/tree_borrows)) |
| Trait objects | Supported — Trait-object types and vtable pointers are part of the type system. ([source](https://github.com/minirust/minirust/blob/master/spec/lang/types.md)) |
| Iterators | Supported — Iterators are ordinary code after translation; tests cover them. ([source](https://github.com/minirust/minirust/tree/master/tooling/minimize/tests/pass)) |
| Panics | Supported — Unwinding, cleanup blocks and catching panics are modeled. ([source](https://github.com/minirust/minirust/blob/master/spec/lang/syntax.md)) |
| async / await | Unknown — Not mentioned in the specification or tests. |

## Sources
- [MiniRust README](https://github.com/minirust/minirust/blob/master/README.md)
- [MiniRust tooling (minimize, minitest)](https://github.com/minirust/minirust/blob/master/tooling/README.md)
- [Pinned rustc nightly for minimize](https://github.com/minirust/minirust/blob/master/rust-toolchain.toml)

---
Last checked 2026-11-26. Data: [JSON](/semantics/minirust.json) · Page: [HTML](/semantics/minirust/) · Methodology v0.1: [/methodology/](/methodology/) · Corrections: [/contribute/](/contribute/)
