jsonvetdocs2. No unsafe code

playgroundthis page on GitHub

2. No unsafe code

Status: accepted (2026-10-19)

Context

jsonvet parses strangers' files in hooks and CI, and SECURITY.md treats a crash on a crafted file as a security bug. Without unsafe, the worst a bad file can do is a panic. Parsers usually reach for unsafe for speed: SIMD, unchecked indexing, memory maps.

Options

Decision

unsafe_code = "forbid" in the workspace Cargo.toml.

Consequences

No memory-safety bug can come from our own code; cargo deny watches dependencies like memchr that do use unsafe. Memory maps are out.

Confirmation

forbid makes any unsafe block a compile error.

Revisit if

Only unsafe can give a speed-up past 5% end to end, and we can fuzz it and run Miri on it on every target.