Skip to content

Generic cells in doppel#663

Merged
mkeeter merged 4 commits into
masterfrom
mkeeter/generic-cells
May 21, 2026
Merged

Generic cells in doppel#663
mkeeter merged 4 commits into
masterfrom
mkeeter/generic-cells

Conversation

@mkeeter
Copy link
Copy Markdown
Contributor

@mkeeter mkeeter commented May 12, 2026

(staged on #662)

This PR makes cell types in doppel generic, then uses that new functionality where relevant.

It requires editing the proc macro to support generic parameters, but then can remove the explicit impl Load for MaybeUninit<T> implementation.

@mkeeter mkeeter requested review from cbiffle, hawkw and labbott May 12, 2026 21:51
@mkeeter mkeeter force-pushed the mkeeter/generic-cells branch from 8b9e7dd to 89d1b37 Compare May 13, 2026 21:41
@mkeeter mkeeter force-pushed the mkeeter/struct-field-unpacking branch from c7878a4 to 4bad0ff Compare May 13, 2026 21:41
@mkeeter mkeeter force-pushed the mkeeter/generic-cells branch from 89d1b37 to b3a0238 Compare May 14, 2026 16:20
@mkeeter mkeeter force-pushed the mkeeter/struct-field-unpacking branch from 4bad0ff to 1469947 Compare May 14, 2026 16:20
@mkeeter mkeeter force-pushed the mkeeter/generic-cells branch from b3a0238 to 8b10ba0 Compare May 14, 2026 16:48
@mkeeter mkeeter force-pushed the mkeeter/struct-field-unpacking branch from 5c809af to 856c262 Compare May 14, 2026 19:08
@mkeeter mkeeter force-pushed the mkeeter/generic-cells branch from 8b10ba0 to 379e0b9 Compare May 14, 2026 19:08
@mkeeter mkeeter force-pushed the mkeeter/struct-field-unpacking branch from 856c262 to 7f67b46 Compare May 18, 2026 19:30
@mkeeter mkeeter force-pushed the mkeeter/generic-cells branch from 379e0b9 to 511a371 Compare May 18, 2026 19:30
@mkeeter mkeeter force-pushed the mkeeter/struct-field-unpacking branch from 7f67b46 to bb9d369 Compare May 18, 2026 19:53
@mkeeter mkeeter force-pushed the mkeeter/generic-cells branch from 511a371 to 356f019 Compare May 18, 2026 19:53
@mkeeter mkeeter force-pushed the mkeeter/generic-cells branch from 356f019 to a45b581 Compare May 20, 2026 19:40
@mkeeter mkeeter force-pushed the mkeeter/struct-field-unpacking branch from bb9d369 to 327fc04 Compare May 20, 2026 19:40
@mkeeter mkeeter requested a review from Copilot May 20, 2026 20:02
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the Load derive proc-macro and the humility_doppel “cell” mirror types to support typed/generic cells (e.g., StaticCell<Ringbuf>), then updates call sites to use the new typed cells and simplify value extraction.

Changes:

  • Extend #[derive(Load)] code generation to include generic parameters for derived struct impls.
  • Make doppel cell wrapper types (ClaimOnceCell, StaticCell, UnsafeCell, MaybeUninit) generic over the loaded payload type and remove the bespoke Load impl for MaybeUninit<T>.
  • Update host, ringbuf, and spd to use typed cell reads (via reflect::read_variable) and avoid redundant from_value calls.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
load_derive/src/lib.rs Adds helper functions to emit generics in generated impl Load blocks for derived structs.
humility-doppel/src/lib.rs Makes cell wrapper types generic and switches MaybeUninit<T> to #[derive(Load)] instead of a manual impl.
humility-spd/src/lib.rs Uses typed ClaimOnceCell<reflect::Struct> loading to simplify packrat buffer handling and removes manual loading steps.
cmd/ringbuf/src/lib.rs Uses StaticCell<Ringbuf> to avoid re-parsing the ringbuf after unwrapping the cell.
cmd/host/src/lib.rs Uses ClaimOnceCell<HostStateBuf> and returns the typed inner value directly.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread load_derive/src/lib.rs Outdated
Comment thread humility-doppel/src/lib.rs
@mkeeter mkeeter force-pushed the mkeeter/struct-field-unpacking branch from 327fc04 to e0f22cf Compare May 20, 2026 20:09
@mkeeter mkeeter force-pushed the mkeeter/generic-cells branch 2 times, most recently from 759562f to a88a132 Compare May 20, 2026 20:45
@mkeeter mkeeter force-pushed the mkeeter/struct-field-unpacking branch from e0f22cf to 2740bf7 Compare May 20, 2026 20:45
@mkeeter mkeeter force-pushed the mkeeter/generic-cells branch from a88a132 to cecefd8 Compare May 20, 2026 23:03
Base automatically changed from mkeeter/struct-field-unpacking to master May 21, 2026 13:43
@mkeeter mkeeter force-pushed the mkeeter/generic-cells branch 2 times, most recently from e363734 to ff617b0 Compare May 21, 2026 14:09
@mkeeter mkeeter force-pushed the mkeeter/generic-cells branch from ff617b0 to 2856341 Compare May 21, 2026 14:24
@mkeeter mkeeter force-pushed the mkeeter/generic-cells branch from 2856341 to d10f467 Compare May 21, 2026 14:37
@mkeeter
Copy link
Copy Markdown
Contributor Author

mkeeter commented May 21, 2026

Tested on gimlet-d:

matt@niles ~ () $ pfexec ./humility -t gimlet-d host boot-fail
humility: attached to 0483:3754:000D00344741500820383733 via ST-Link V3
Message contains no non-NUL bytes, not printing.
matt@niles ~ () $ pfexec ./humility -t gimlet-d spd
humility: attached to 0483:3754:000D00344741500820383733 via ST-Link V3
ADDR MANUFACTURER              PART                 WEEK YEAR
   0 Micron Technology         36ASF8G72PZ-3G2F1       2 2023
   1 Micron Technology         36ASF8G72PZ-3G2F1       2 2023
   2 Micron Technology         36ASF8G72PZ-3G2F1       2 2023
   3 Micron Technology         36ASF8G72PZ-3G2F1       2 2023
   4 Micron Technology         36ASF8G72PZ-3G2F1       2 2023
   5 Micron Technology         36ASF8G72PZ-3G2F1       2 2023
   6 Micron Technology         36ASF8G72PZ-3G2F1       2 2023
   7 Micron Technology         36ASF8G72PZ-3G2F1       2 2023
   8 Micron Technology         36ASF8G72PZ-3G2F1       2 2023
   9 Micron Technology         36ASF8G72PZ-3G2F1       2 2023
  10 Micron Technology         36ASF8G72PZ-3G2F1       2 2023
  11 Micron Technology         36ASF8G72PZ-3G2F1       2 2023
  12 Micron Technology         36ASF8G72PZ-3G2F1       2 2023
  13 Micron Technology         36ASF8G72PZ-3G2E1      34 2022
  14 Micron Technology         36ASF8G72PZ-3G2F1       2 2023
  15 Micron Technology         36ASF8G72PZ-3G2F1       2 2023

@mkeeter mkeeter enabled auto-merge (squash) May 21, 2026 14:43
@mkeeter mkeeter merged commit c79e544 into master May 21, 2026
12 checks passed
@mkeeter mkeeter deleted the mkeeter/generic-cells branch May 21, 2026 15:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants