Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Safety Playground

An interactive walk-through of the PyPTO memory-safety pipeline — PyPTO .py → stage-1 PTO MLIR → emitted Rust → rustc verdict — showing where each memory-safety bug is caught (use-after-realloc → E0382, device-side data race → E0308).

Pick an example on the left, then use the process buttons to lower it, emit Rust, and run the check. When a step produces several artifacts (e.g. a bug/ok pair), cycle through them with ◀ ▶. The whole pipeline runs in your browser (WebAssembly); nothing is sent to a server.

⬇ Download desktop app (Windows x86-64) Linux x86-64 runs rustc live · see details below

🎬 Watch the 4-part walkthrough (ptoas vs rustc · Miri dynamic analysis): ▶ English ▶ 中文

Trouble loading? Open it full-screen at safety-playground/.

This is distinct from the Playground (a compile/simulate service for editing kernels). The Safety Playground is a self-contained, client-side tour of the safety-checking pipeline and its fixtures.

Download the desktop app

The same playground runs as a native desktop app. Unlike the in-browser version, the desktop build runs rustc live on the emitted Rust when a Rust toolchain is present, so you see freshly-computed verdicts (it falls back to the bundled results otherwise).

PlatformDownloadRun
Windows x86-64 (recommended)playground_desktop-windows-x86_64.zipunzip, then double-click playground_desktop-windows-x86_64.exe
Linux x86-64playground_desktop-linux-x86_64.gzgunzip playground_desktop-linux-x86_64.gz && chmod +x playground_desktop-linux-x86_64 && ./playground_desktop-linux-x86_64

The Windows build is a native 64-bit .exe and is the simplest option on Windows (including under WSL — run the .exe from Windows itself, not from the Linux shell). The Linux build is statically linked (musl): no glibc version requirement, runs on any x86-64 Linux, and links both the X11 and Wayland display backends.

The desktop app needs a graphical display. On Windows, the .exe works natively. A Linux binary run inside WSL needs WSLg (WSL2’s X11/Wayland support on Windows 11 / recent Windows 10) — without it there is no display and no native Linux GUI can open. If echo $DISPLAY is empty in your shell, use the Windows .exe or the in-browser version above instead.

SHA-256:
linux-x86_64.gz   e890e4a14c784c2de8ba9526481f27274ba44762f6256802eac68314eb3df0af
windows-x86_64.zip dde9b2e965a9eadb16d95567227ef64c96f12fd6ed761be9591d68773764dbd8

…or with a bundled Rust toolchain (live verdicts, no install)

The small downloads above show precomputed verdicts unless you already have rustc installed. These larger bundles ship a trimmed Rust toolchain next to the binary, so the Check step runs rustc live (--emit=metadata — it reaches the borrow/type verdict without a linker) on any machine, with no Rust installed. Same app; ~150 MB because they include the toolchain.

PlatformDownload (with bundled rustc)Run
Windows x86-64…-windows-x86_64-with-rustc.zip (~154 MB)unzip, run the .exe (keep the rust/ folder beside it)
Linux x86-64…-linux-x86_64-with-rustc.tar.xz (~135 MB)tar xf …-with-rustc.tar.xz && ./playground_desktop-linux-x86_64

SHA-256:
linux-…-with-rustc.tar.xz   eac7393dc2bc85177b1b4f0beccde46c2bfbe7f9131590e738cd3ae3e3639796
windows-…-with-rustc.zip 0feba6010787663db0c6272aa46ffa9102be8563aee5c72678f81fc45d1aeb65

macOS: no prebuilt binary is hosted (building the macOS app requires Apple’s SDK, which can’t be redistributed). On a Mac it builds from source in one step — install Rust and run:

git clone <ascend-rs repo>   # the safety_playground/ workspace
cd safety_playground
cargo run --release --bin playground_desktop