Next Steps
This is a loose, prioritized TODO list of features we plan to add next. It is not meant to be comprehensive — a lot of coverage will come as we try more complex examples.
Interpreter features
Roughly in priority order (top first):
PassMode::Castin the native ABI. Passing/returning small structs and arrays by value across the C ABI. The single largest bucket of ignored tests. NeedsCastTargetexposed from rustc_public (see below).- Atomic intrinsics (
atomic_load/atomic_store/atomic_xsub, …). Needed by anything with an atomic refcount or an interior-mutablestatic:Arccoerces and dispatches correctly but cannot be dropped, andAtomicU32::storeis unsupported. - Float comparison (
Eq/ordering onf32/f64). - Calling a
fnpointer through theFntraits. TheFnOnce/FnMutimpls forfnpointers are shims without bodies, so passing a function (rather than a closure) where a closure is expected fails with an argument count mismatch — e.g.iter().max(), which callsOrd::cmpthrough one. - Other collections (
Stringgrowth beyond the basics, maps, sets).Vecworks; the rest are untested. - Crate loading.
- Unwinding.
UnwindActionis ignored, so a panic ends interpretation without running cleanup and destructors do not run on the panic path. Assertmessages.AssertMessage::descriptiondrops the operands, so a failed bounds check reportsindex out of boundswhere rustc reportsindex out of bounds: the len is 2 but the index is 5.- Rendering formatted panic messages.
panic!("{x}"),assert_eq!and libcore’s UB checks build acore::fmt::Arguments, andResult::unwrapformats theErrthroughdyn Debug. Rendering them needsdyn Debugdispatch through vtables whose slots hold our synthetic reified addresses. - Threads. Needs rustc_public support, then making the
Statics/Codesegments shareable across threads (they are currently single-threaded).
Native calls
PassMode::Castsupport (requiresCastTargetin rustc_public) — see thePassMode::Castinterpreter item above.- Symbol caching (avoid repeated
dlsymlookups). - Trampoline caching (reuse compiled trampolines for identical signatures).
- Function-pointer callbacks (native → interpreter via JIT stubs). A reified
fnpointer maps to anInstancewe interpret, but its synthetic address is not real machine code, so native code cannot call it until we JIT re-entry stubs. - Handle uninitialized padding bytes written in native code. Possible changes:
- Track all memory reachable across the interpreter/native boundary.
- Change Value to use MaybeUninit
and treat padding as uninitialized. - Sanitize values from native code by zeroing their padding bytes.
RustC Public
Improvements we would like in rustc_public:
- Add
PlaceRefto make processing aPlacemore efficient (would let the interpreter avoid recreating places). - Add a way to retrieve all mono items.
- Add a way to retrieve the source for a span (for
annotate_snippets). - Expose
CastTargetdetails fromPassMode::Cast(needed for struct pass/return in the C ABI) — see thePassMode::Castinterpreter item. - Build the caller location from the call terminator’s
fn_span, asrustc_codegen_ssadoes, rather than fromsource_info.span. The two differ for a method call: rustc and Miri reportx.unwrap()at theunwrapsegment, whileBody::caller_locationreports the start of the receiver, so a panic’s column does not match.TerminatorKind::Callwould also need to exposefn_span.