Skip to content

Support memset on structs - #634

Open
nazar-pc wants to merge 1 commit into
Rust-GPU:mainfrom
nazar-pc:fix-memset
Open

Support memset on structs#634
nazar-pc wants to merge 1 commit into
Rust-GPU:mainfrom
nazar-pc:fix-memset

Conversation

@nazar-pc

@nazar-pc nazar-pc commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

I decided to ask Claude to fix #312 and it turned out fairly simple.

Here is LLM-generated description of changes:

Implement memset_const_pattern and memset_dynamic_pattern for SpirvType::Adt by recursively building a fill pattern per field and composing them into a struct constant/composite, instead of hitting fatal!("memset on structs not implemented yet").

This unblocks crates that zero-init or byte-fill whole structs (e.g. core::mem::zeroed::<T>() on a struct type), such as the blake3 crate hitting this on self.buf = [0; BLOCK_LEN].

With this change I can add blake3 crate to dependencies and things continue to compile without issues, while previously I was hitting an error like this:

  error: memset on structs not implemented yet
     --> /home/nazar-pc/.cargo/git/checkouts/blake3-697b574540d368df/c7f0d21/src/lib.rs:550:17
      |
  550 |                 self.buf = [0; BLOCK_LEN];
      |                 ^^^^^^^^^^^^^^^^^^^^^^^^^

Fixes #312, closes #328

@nazar-pc nazar-pc mentioned this pull request Aug 4, 2026
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.

Unclear ICE

1 participant