Skip to content

docs: frame the inverse annotations as structured safety comments - #2229

Merged
richlander merged 1 commit into
mainfrom
docs/inverse-annotation-framing
Jul 3, 2026
Merged

docs: frame the inverse annotations as structured safety comments#2229
richlander merged 1 commit into
mainfrom
docs/inverse-annotation-framing

Conversation

@richlander

Copy link
Copy Markdown
Owner

Change

Docs-only. Adds a "Prior art: the structured safety comment" section to docs/design/inverse-architecture.md, placed after "Two levels: the prose and the code".

It frames the [InverseOf] annotation as a species of Rust // SAFETY: comment: a second, human-authored viewpoint (the justification) that must agree with the implementation (the mechanism), reconciled by review rather than by the compiler — except where an assumes: predicate makes the reconciliation executable (the // SAFETY:-comment vs. debug_assert! distinction). This makes explicit what kind of artifact the annotations are, and why the coverage gate exists (every in-domain node annotated ≈ Clippy's undocumented_unsafe_blocks on every unsafe block).

Cites the structured-attribute prior art — both verified via the GitHub API (an initial web search hallucinated the RFC numbers, so I confirmed the real ones):

Evidence

Docs-only, no measured-behavior claims. markdownlint docs/design/inverse-architecture.md clean. Single file, +31 lines.

Risk

Low — documentation framing only. Per the docs-only carve-out, stopping at markdownlint; no adversarial round needed.

Adds a "Prior art: the structured safety comment" section to the inverse-
architecture framing doc. The [InverseOf] annotation is a species of Rust
`// SAFETY:` comment: a second, human-authored viewpoint (the justification)
that must agree with the implementation (the mechanism), reconciled by review
rather than by the compiler — except where an `assumes:` predicate makes the
reconciliation executable (the SAFETY-comment vs debug-assert distinction).

References the structured-attribute prior art (both verified via GitHub API):
- rust-lang/rfcs#3842 "Safety Tags" (`#[safety::requires(...)]` / `#[safety::checked]`),
  the freeform-comment -> named-field-attribute move [InverseOf] also makes.
- rust-lang/rust#128044 "Contracts" (`#[core::contracts::requires/ensures]`),
  the executable analog to the `assumes:` predicate.

Docs-only, no behavior claims; markdownlint clean.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@richlander
richlander merged commit 26ba372 into main Jul 3, 2026
5 checks passed
@richlander
richlander deleted the docs/inverse-annotation-framing branch July 3, 2026 15:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant