[pr-docs][MULDER][hle] native_dstorage: SAFETY comments on its unsafe blocks #639

Open
iBooM72 wants to merge 1 commit from iboom72/native-dstorage-safety into Main AGit
Contributor

What it changes

  • The problem on main: read from the code only. crates/darner-hle/src/modules/dstorage/native_dstorage.rs has 15 unsafe blocks and impls without a // SAFETY: comment; three had a reason, but without the tag. It is the largest such group in darner-hle: clippy finds 8 or fewer in each other file.

Each block now says why it is sound: the loaded bridge is never freed, the exports have the signatures bridge.cpp declares, and the out-pointers and the output slice are valid. Comments only, except that the one-line impl Drop for NativeFile is spread over five lines, so its comment sits right above the unsafe block, where the lint looks for it.

How it was tested

  • Tested revision: 03c43460 (on main c8258f95)
  • Commands and results:
    • cargo clippy -p darner-hle --lib --locked -- -W clippy::undocumented_unsafe_blocks: no hit in native_dstorage.rs (30 in other darner-hle files, untouched here).
    • cargo clippy -p darner-hle --lib --locked -- -D warnings: clean.
  • Changes a default: no
  • Gates run on that revision: none of the three workspace gates.
  • Gameplay: not relevant (comments and a reformat).
  • Coverage gaps: none.

Checklist

  • I ran this change in the game, or say below why it can't be (docs, tests only). Comments only.
  • This PR contains one change based on main.
  • The diff follows docs/asset-policy.md.
  • I recorded this PR's dependencies below.
    • Depends on: none

Checked for overlap

  • I searched the open pull requests for the same issue and for the files this touches.
  • Related PRs: #285 and #314 (both merged) added the same kind of comment in darner-gpu, darner-core, darner-loader and a shader test. No open PR touches this file; #337 edits the neighbouring dstorage.rs.
  • Replaces or overlaps: none found

Checked with AI assistance (Claude Code).

🤖 Generated with Claude Code

<!-- Thanks for the pull request. Start the title with its type (pr-fix, pr-feature, pr-performance, pr-diagnostics, pr-refactor, pr-docs or pr-tests) and the area tags, like [pr-fix][memory]. This host has no labels yet, so the tags stay in the title. --> ## What it changes - The problem on main: read from the code only. `crates/darner-hle/src/modules/dstorage/native_dstorage.rs` has 15 `unsafe` blocks and impls without a `// SAFETY:` comment; three had a reason, but without the tag. It is the largest such group in darner-hle: clippy finds 8 or fewer in each other file. Each block now says why it is sound: the loaded bridge is never freed, the exports have the signatures `bridge.cpp` declares, and the out-pointers and the output slice are valid. Comments only, except that the one-line `impl Drop for NativeFile` is spread over five lines, so its comment sits right above the `unsafe` block, where the lint looks for it. ## How it was tested - Tested revision: `03c43460` (on `main` `c8258f95`) - Commands and results: - `cargo clippy -p darner-hle --lib --locked -- -W clippy::undocumented_unsafe_blocks`: no hit in `native_dstorage.rs` (30 in other darner-hle files, untouched here). - `cargo clippy -p darner-hle --lib --locked -- -D warnings`: clean. - Changes a default: no - Gates run on that revision: none of the three workspace gates. - Gameplay: not relevant (comments and a reformat). - Coverage gaps: none. ## Checklist - [ ] I ran this change in the game, or say below why it can't be (docs, tests only). Comments only. - [x] This PR contains one change based on `main`. - [x] The diff follows `docs/asset-policy.md`. - [x] I recorded this PR's dependencies below. - Depends on: none ## Checked for overlap - [x] I searched the open pull requests for the same issue and for the files this touches. - Related PRs: #285 and #314 (both merged) added the same kind of comment in darner-gpu, darner-core, darner-loader and a shader test. No open PR touches this file; #337 edits the neighbouring `dstorage.rs`. - Replaces or overlaps: none found Checked with AI assistance (Claude Code). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
The 15 unsafe blocks and impls of the DirectStorage bridge's loader had
none, or a reason without the SAFETY: tag, which clippy's
undocumented_unsafe_blocks looks for. Comments only, except that the
one-line impl Drop is spread over lines so its comment sits above the
block, where the lint looks for it.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
TrustNo1 changed title from [pr-docs] native_dstorage: SAFETY comments on its unsafe blocks to native_dstorage: SAFETY comments on its unsafe blocks 2026-12-06 03:25:43 +00:00
iBooM72 changed title from native_dstorage: SAFETY comments on its unsafe blocks to [pr-docs][MULDER][hle] native_dstorage: SAFETY comments on its unsafe blocks 2026-12-06 05:48:56 +00:00
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/639/head:iboom72/native-dstorage-safety'
git switch 'iboom72/native-dstorage-safety'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'Main'
git merge --no-ff 'iboom72/native-dstorage-safety'
git switch 'iboom72/native-dstorage-safety'
git rebase 'Main'
git switch 'Main'
git merge --ff-only 'iboom72/native-dstorage-safety'
git switch 'iboom72/native-dstorage-safety'
git rebase 'Main'
git switch 'Main'
git merge --no-ff 'iboom72/native-dstorage-safety'
git switch 'Main'
git merge --squash 'iboom72/native-dstorage-safety'
git switch 'Main'
git merge --ff-only 'iboom72/native-dstorage-safety'
git switch 'Main'
git merge 'iboom72/native-dstorage-safety'
git push origin 'Main'
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
TrustNo1/Darner!639
No description provided.