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

Merged
MoonEyes merged 1 commit from upstream-pr/3361 into main 2026-12-03 18:05:49 +00:00
MoonEyes commented 2026-12-03 16:23:48 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-03T16:23:48Z.


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

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5630492943 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3361). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-12-03T16:23:48Z. --- 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)_
Kal0s-design commented 2026-12-03 17:14:39 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Kal0s-design on 2026-12-03T17:14:39Z.


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).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7386196980 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3361#issuecomment-7386196980). Originally posted by [Kal0s-design](https://github.com/Kal0s-design) on 2026-12-03T17:14:39Z. --- 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).
Sign in to join this conversation.
No reviewers
No labels
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.

Reference
ProjectLeonida/mandy!3361
No description provided.