menu

undocumented-unsafe

Require a safety rationale for every unsafe declaration and expression

Unsafe callables impose obligations on their callers, while unsafe implementations and local regions rely on invariants the checker cannot verify. Instead, you SHOULD document caller obligations under # Safety and justify implementations and local regions with an immediately preceding SAFETY: comment or a nonempty @unsafe reason.

Reported

1function execute(): void {2    @unsafe3    {}4}

Accepted

1function execute(): void {2    // SAFETY: no unsafe operation escapes this region3    @unsafe4    {}5}