Name the heap field of book::Slot so it reads as owned, not unused #3361

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

@⁠MoonEyes on GitHub · 2026-12-03 16:23 UTC · original
ProjectLeonida:fix/book-slot-heap-never-read → main · +8 −3 · 1 files · 1 commits · open

Claimed in the coordination issue as: #3174 (second warning, claim comment in #3312)

Refs: #3174 (together with #3358 it removes both warnings of the issue; close it once both have landed)

What and why

struct Slot(ID3D12DescriptorHeap, usize) in book.rs only holds the descriptor heap alive while the CPU address in field 1 is used, so field 0 is never read and the warning is legitimate for a tuple. A tuple field cannot take the _ ownership prefix the crate uses elsewhere (_keep, _roots, _alive, _piece), so Slot becomes a struct with named fields { _heap, at }, with a doc comment on why the heap is kept. The field is not removed, no #[allow], the unsafe impl Send and its SAFETY comment are unchanged, and there is one construction site and one read site.

Tested

  • cargo check -p leonida-gpu --tests --locked --target x86_64-pc-windows-msvc from Linux (read-only reviewer), with and without --features diagnostics: no warning from book.rs.
  • python -I scripts/check_no_game_data.py: clean.
  • No red/green test: the proof is the compiler output; the warning was not reproduced on main by the reviewer.

GPUs tested: n/a

AI-assisted: yes. Written with Claude Sonnet 5.5; independently reviewed read-only by Claude Opus 5.5 (verdict OK).

Checklist

  • Based on current main and merges cleanly.
  • One topic.
  • No game data, keys or decryption.
  • Not a translator rule.

Generated by Claude Code

**@⁠MoonEyes** on GitHub · 2026-12-03 16:23 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/3361) `ProjectLeonida:fix/book-slot-heap-never-read` → `main` · +8 −3 · 1 files · 1 commits · open Claimed in the coordination issue as: #3174 (second warning, claim comment in #3312) Refs: #3174 (together with #3358 it removes both warnings of the issue; close it once both have landed) ### What and why `struct Slot(ID3D12DescriptorHeap, usize)` in `book.rs` only holds the descriptor heap alive while the CPU address in field 1 is used, so field 0 is never read and the warning is legitimate for a tuple. A tuple field cannot take the `_` ownership prefix the crate uses elsewhere (`_keep`, `_roots`, `_alive`, `_piece`), so `Slot` becomes a struct with named fields `{ _heap, at }`, with a doc comment on why the heap is kept. The field is not removed, no `#[allow]`, the `unsafe impl Send` and its SAFETY comment are unchanged, and there is one construction site and one read site. ### Tested - `cargo check -p leonida-gpu --tests --locked --target x86_64-pc-windows-msvc` from Linux (read-only reviewer), with and without `--features diagnostics`: no warning from `book.rs`. - `python -I scripts/check_no_game_data.py`: clean. - No red/green test: the proof is the compiler output; the warning was not reproduced on `main` by the reviewer. GPUs tested: n/a AI-assisted: yes. Written with Claude Sonnet 5.5; independently reviewed read-only by Claude Opus 5.5 (verdict OK). ### Checklist - [x] Based on current `main` and merges cleanly. - [x] One topic. - [x] No game data, keys or decryption. - [x] Not a translator rule. --- _Generated by [Claude Code](https://claude.ai/code)_
Slot(ID3D12DescriptorHeap, usize) warned "field 0 is never read": the heap is held only to keep it alive for the CPU address in field 1. Use named fields with the crate convention for keep-alive fields (_keep, _roots, _alive) and document the ownership role.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01DDMsHwsknvo96XTWag2WiL
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-03 16:32:21 +00:00
Author
Owner

@⁠Kal0s-design on GitHub · 2026-12-03 17:14 UTC · original

Ran natively on Windows 11, head 3b179e734 merged into current main (717b90233, clean merge).

No findings. The warning only shows up with --features diagnostics, which is probably why it wasn't reproduced on main without it. Measured with MSVC Rust on leonida-gpu:

check main merge
cargo check -p leonida-gpu --all-targets --features diagnostics 2 warnings (Slot field 0 in book.rs:247, batched in indirect.rs:532) only the indirect.rs one left
cargo clippy -p leonida-gpu --all-targets --features diagnostics -- -D warnings 10 errors 9, the book.rs one is gone
same clippy without diagnostics clean clean

With #3358 merged on top as well, cargo check --features diagnostics is warning-free; the two merge cleanly together. The 8 clippy errors left with diagnostics are already on main in other files.

Not checked: running texture_address itself (the heap is still owned by the static, so lifetime is unchanged; read).

GPUs tested: n/a (CPU-only tests).
AI-assisted: yes (Claude Code).

**@⁠Kal0s-design** on GitHub · 2026-12-03 17:14 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/3361#issuecomment-7386196980) Ran natively on Windows 11, head `3b179e734` merged into current `main` (`717b90233`, clean merge). No findings. The warning only shows up with `--features diagnostics`, which is probably why it wasn't reproduced on `main` without it. Measured with MSVC Rust on `leonida-gpu`: | check | `main` | merge | |---|---|---| | `cargo check -p leonida-gpu --all-targets --features diagnostics` | 2 warnings (`Slot` field 0 in `book.rs:247`, `batched` in `indirect.rs:532`) | only the `indirect.rs` one left | | `cargo clippy -p leonida-gpu --all-targets --features diagnostics -- -D warnings` | 10 errors | 9, the `book.rs` one is gone | | same clippy without `diagnostics` | clean | clean | With #3358 merged on top as well, `cargo check --features diagnostics` is warning-free; the two merge cleanly together. The 8 clippy errors left with `diagnostics` are already on `main` in other files. Not checked: running `texture_address` itself (the heap is still owned by the static, so lifetime is unchanged; read). GPUs tested: n/a (CPU-only tests). AI-assisted: yes (Claude Code).
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/3361/head:github-bot/gh-3361'
git switch 'github-bot/gh-3361'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-3361'
git switch 'github-bot/gh-3361'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-3361'
git switch 'github-bot/gh-3361'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-3361'
git switch 'main'
git merge --squash 'github-bot/gh-3361'
git switch 'main'
git merge --ff-only 'github-bot/gh-3361'
git switch 'main'
git merge 'github-bot/gh-3361'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No reviewers
No milestone
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
github/ubiquitarianism--leonida!3361
No description provided.