Turn undocumented_unsafe_blocks back on: six SAFETY comments the lint can read #30

Open
github-bot wants to merge 1 commit from github-bot/gh-30 into main AGit
Owner

@⁠viktoschi on GitHub · 2026-11-24 20:35 UTC · original
viktoschi:tidy-unsafe-safety-comments → main · +18 −12 · 4 files · 1 commits · open

What this does

Turns undocumented_unsafe_blocks back on. The workspace comment said eleven
blocks in the newer GPU code still lacked a safety comment; six were still
reported, and all six had a comment — just not one the lint reads.

Site What was wrong
victory-gpu/src/host.rs:5370 the SAFETY: above belonged to the zeroed() on the line before; the VirtualQuery call had none of its own
victory-gpu/src/indirect.rs:376 the SAFETY: for the whole block sat above the diagnostics lets, not above the unsafe
victory-gpu/src/indirect.rs:701 SAFETY (each): — the lint wants SAFETY:
inplace.rs:617, :685, :760 SAFETY (the whole function): — same form problem

Each comment now states the same invariant as before, in the form the lint
recognises; the clamp's comment moved down to its block and the sparse read's
VirtualQuery got its own.

Cargo.toml:

undocumented_unsafe_blocks = "warn"

so the next block added without a SAFETY: comment fails -D warnings.

Checks

  • cargo clippy --workspace --all-targets --locked -- -D warnings — clean
  • cargo clippy --workspace --all-targets --all-features --locked -- -D warnings — clean
  • cargo test --workspace --locked — all green (211 passed, 2 ignored; the GPU tests ran on an RTX 3090)
  • cargo xtask install-hooks + the pre-commit asset policy on this commit — 4 files ok

No code changed: comments and the lint level only.

Not in this PR

type_complexity (7 sites) and needless_range_loop (9 sites) stay allowed —
those want type aliases and loop rewrites in the translator, not a comment.

**@⁠viktoschi** on GitHub · 2026-11-24 20:35 UTC · [original](https://github.com/fxceless/victory-fork/pull/30) `viktoschi:tidy-unsafe-safety-comments` → `main` · +18 −12 · 4 files · 1 commits · open ## What this does Turns `undocumented_unsafe_blocks` back on. The workspace comment said eleven blocks in the newer GPU code still lacked a safety comment; six were still reported, and all six had a comment — just not one the lint reads. | Site | What was wrong | | --- | --- | | `victory-gpu/src/host.rs:5370` | the `SAFETY:` above belonged to the `zeroed()` on the line before; the `VirtualQuery` call had none of its own | | `victory-gpu/src/indirect.rs:376` | the `SAFETY:` for the whole block sat above the diagnostics `let`s, not above the `unsafe` | | `victory-gpu/src/indirect.rs:701` | `SAFETY (each):` — the lint wants `SAFETY:` | | `inplace.rs:617`, `:685`, `:760` | `SAFETY (the whole function):` — same form problem | Each comment now states the same invariant as before, in the form the lint recognises; the clamp's comment moved down to its block and the sparse read's `VirtualQuery` got its own. `Cargo.toml`: ```toml undocumented_unsafe_blocks = "warn" ``` so the next block added without a `SAFETY:` comment fails `-D warnings`. ## Checks - `cargo clippy --workspace --all-targets --locked -- -D warnings` — clean - `cargo clippy --workspace --all-targets --all-features --locked -- -D warnings` — clean - `cargo test --workspace --locked` — all green (211 passed, 2 ignored; the GPU tests ran on an RTX 3090) - `cargo xtask install-hooks` + the pre-commit asset policy on this commit — 4 files ok No code changed: comments and the lint level only. ## Not in this PR `type_complexity` (7 sites) and `needless_range_loop` (9 sites) stay allowed — those want type aliases and loop rewrites in the translator, not a comment.
`undocumented_unsafe_blocks` was allowed because blocks in the newer GPU
code lacked a safety comment; six were still reported. All six had a
comment, but not in the form the lint reads: `SAFETY (...)` instead of
`SAFETY:`, a comment above the diagnostics code rather than above the
block, or one that belonged to the statement before it.

Reformat them, move the clamp's comment down to its block, and give the
sparse read's `VirtualQuery` its own. The lint is on now, so the next
block without a `SAFETY:` comment fails `-D warnings`.

No code change. `cargo clippy --workspace --all-targets --locked -- -D
warnings` (also `--all-features`) and `cargo test --workspace --locked`
pass.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:34:53 +00:00
This pull request has changes conflicting with the target branch.
  • crates/victory-gpu/src/indirect.rs
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/30/head:github-bot/gh-30'
git switch 'github-bot/gh-30'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-30'
git switch 'github-bot/gh-30'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-30'
git switch 'github-bot/gh-30'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-30'
git switch 'main'
git merge --squash 'github-bot/gh-30'
git switch 'main'
git merge --ff-only 'github-bot/gh-30'
git switch 'main'
git merge 'github-bot/gh-30'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.