ourc Node: 3 Limitations Next: 4 Building from hex Prev: 2 Reference Up: Top

3 Limitations

ourc is under active development, and full parity with rustc’s test suite is a goal of the project. This node states the promise, how it was measured against v0.1.1, and what is out of scope today.

Its correctness promise is about the programs it accepts.

3.1 The promise

ourc compiles a subset of Rust correctly, and refuses the rest. If ourc accepts a program, the executable it builds produces the same output and exit code as rustc’s build. When it cannot compile something faithfully, it refuses it instead of guessing.

3.2 How it was measured

Every test in rustc 1.99.1’s tests/ui suite, 20,072 files, was run against the v0.1.1 release binary with ui-full.sh. A run-pass test is OK if ourc accepts it and the built executable’s stdout and exit code equal rustc’s, and WRONG if they differ. A check-pass or build-pass test is OK if ourc accepts it; a compile-fail test is OK if ourc rejects it.

0wrong answersof the 3,676 run-pass programs whose output was compared with rustc’s
54%tests OK10,837 of 20,072: valid programs compiled correctly, invalid ones rejected
0crashesof ourc, or of a program it built where rustc’s does not crash
classtestsOKWRONGrefusedcrash
run-pass3,7601,10302,5730
check / build-pass4,1531,550—2,6030
compile-fail12,1598,184 rejected——0

The 84 remaining run-pass tests could not be built or run by rustc itself in the test environment, and are not counted. “crash” counts both ourc crashing and a program it built crashing where rustc’s does not.

3.3 What is not supported

A refused program names the construct ourc stopped at. These are the largest areas outside the v0.1 subset, measured over the refused valid programs.

Most of the standard libraryourc models a core of std: Vec, String and &str, Option, Result, Box, Rc, HashMap, iterators and their common adapters, the formatting macros, std::fs::read_to_string, std::env::args, std::process::exit. See 2.9.
Macros beyond the common formsmacro_rules! with the usual fragment kinds works; an inner repetition separator other than , and some fragment combinations are refused. Procedural macros, and derives other than the built-in ones, are not supported.
Unstable featuresAny program that needs #![feature(..)] is refused; ourc targets stable Rust.
Advanced types and traitsConst generics on types, higher-ranked trait bounds in some positions, trait objects of std traits, many associated-type and where-clause forms, and complex trait resolution.
Concurrency and low levelasync and await, coroutines, threads beyond simple forms, inline assembly, unions, and most of unsafe FFI (extern "ABI" items).
Layout attributes#[repr(packed)] and #[repr(align(N))] are not honoured, so a program that observes layout under them (size_of, align_of, offset_of, addresses) is refused.
Some {:?} outputDebug formatting of a HashMap inside format!, of generic enum payloads, and of sequences of () is refused rather than printed incorrectly.
Multi-crate programsOne source file plus its mod files; extern crate and Cargo dependencies are not supported.

3.4 Accepts invalid programs

ourc implements only part of rustc’s checking: borrow checking, trait coherence, lint-level errors and much of type inference are partial. It accepts some programs that rustc rejects, 3,975 of the 12,159 compile-fail tests. Closing that gap is part of the goal of full rustc parity; until then, use rustc to check whether a program is valid Rust.

3.5 Platform and resources

platformx86-64 Linux only. Producing executables needs llc (LLVM 16 or newer) and a C compiler and linker, cc, at run time.
wordsIntegers and pointers are modelled as 64-bit words; f32, i128 and u128 are refused.
limitsBy default a compile is refused after 25 seconds or 8 GiB of memory (--time-limit, --mem-limit; 0 lifts either). ourc compiling its own source needs both lifted.
memoryMemory a compiled program allocates is not freed while it runs; long-running or allocation-heavy programs can run out of memory, and then exit with “memory allocation failed”.