docs: frame the inverse annotations as structured safety comments - #2229
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 anassumes: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'sundocumented_unsafe_blockson everyunsafeblock).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):
#[safety::requires(valid_ptr = "…", aligned = "…")]+#[safety::checked], the freeform-comment → named-field-attribute move[InverseOf]also makes.#[core::contracts::requires/ensures], the executable analog to theassumes:predicate.Evidence
Docs-only, no measured-behavior claims.
markdownlint docs/design/inverse-architecture.mdclean. Single file, +31 lines.Risk
Low — documentation framing only. Per the docs-only carve-out, stopping at markdownlint; no adversarial round needed.