OverviewTypeScriptKotlinPythonGoRustC++

Rust

Write a small numeric program in Rust. zlow compiles it to a native binary — no Cargo, no rustc-as-driver, no cranelift. If we don’t support something yet, you get a clear error instead of a guess.

Project setup

Put a zlow.json in the project root. It only needs the language and the entry file:

JSON
{ "language": "rust", "entry": "src/main.rs" }

You can add languageVersion if you want to pin it. This release supports 1.96.0(checked against 1.96.0). Anything else is rejected. To expose symbols from a shared library, add an exports array.

native

Compile from the project file, emit LLVM if you want the IR, or link a shared library with a header and binding.

Terminal
zlow native .                       # zlow.json in the current dir
zlow native src/main.rs --emit-llvm out.ll
zlow native . -o kernel             # link a native executable
zlow native . -o libkernel.so --emit-shared --emit-header kernel.h --emit-binding binding.rs

Real code today

We test the kernel against 58 real numeric functions, copied unchanged from the libm, statrs, and puruspe crates, each with a small driver. Today zlow compiles none of them. Every one uses something v0 refuses. The most common: pub (58 functions), const orstatic (43), method calls such as x.ln() (41), integer literals (33), and tuples or arrays (27). Integers are next.

The set and its selection rule are in corpus-rust-real.tools/real-corpus.sh rust runs it against pinned rustc and prints the counts.

versions

Rust is a single supported version this release: 1.96.0, checked against pinned rustc 1.96.0. zlow versions rust shows that row. Pass--language-version to override zlow.json for one run.

Terminal
zlow versions rust
zlow native . --language-version 1.96.0