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

Code

Clone this repository

Checkout

From your project repository, check out a new branch and test the changes.

git fetch -u origin "github-pr/3361:github-pr/3361"
git switch "github-pr/3361"
Open
leonida/mandy
MoonEyes wants to merge 1 commit from github-pr/3361 into main

This branch is out-of-date with the base branch

Conversation
Reviewers 0 approvals
  • No reviewers
Details
This pull request is blocked because it's outdated.
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 'github-pr/3361:github-pr/3361'
git switch 'github-pr/3361'
MoonEyes commented 2026-12-03 16:23:48 +00:00

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

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

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

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

Naming the field _heap and the address at says what the ownership is for, and removes the warning without an #[allow(dead_code)]. Correct. No objection.

Naming the field `_heap` and the address `at` says what the ownership is for, and removes the warning without an `#[allow(dead_code)]`. Correct. No objection.
Sign in to join this conversation.
No description provided.