Audit: Maximum number of fields in derived types in the ecosystem

Open
#3,667 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
45/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
rust
Domain
tooling

Research direction

Start by reviewing the listed ecosystem projects and the cpuarch::VMSA type in coconut-svsm, which the issue identifies as having 120 fields. Record the largest derived types found and compare them with the supported field limit. Done means producing an evidence-backed recommendation for the limit.

Written by the indexing model from the issue text.

Description

TL;DR: 120 fields

We have upcoming work that will require a dedicated trait impl for each supported number of fields. Before choosing a limit, it would be useful to know how many fields real zerocopy users actually need.

I did a best-effort ecosystem scan for public Rust crates/projects that use zerocopy derives:

Users
  • signalapp/libsignal
  • lowRISC/opentitan
  • google/crosvm
  • theseus-os/Theseus
  • managarm/managarm
  • oxidecomputer/hubris
  • bitflags/bitflags
  • awslabs/mountpoint-s3
  • cberner/fuser
  • tailscale/tailscale-rs
  • project-oak/oak
  • ChainSafe/forest
  • microsoft/litebox
  • kaspanet/rusty-kaspa
  • coconut-svsm/svsm
  • elodin-sys/elodin
  • messense/mupdf-rs
  • bitshifter/glam-rs
  • sampsyo/bril
  • rust-vmm/kvm
  • synacktiv/frinet
  • zlfn/rust-gb
  • taks/esp32-nimble
  • supervc-stack/VectorChord-bm25
  • memorysafety/rav1d
  • worldcoin/orb-software
  • category-labs/monad-bft
  • SecureDNA/SecureDNA
  • microsoft/openvmm
  • rosenpass/rosenpass
  • OpenDevicePartnership/patina
  • n0-computer/iroh-willow
  • rust-osdev/virtio-spec-rs
  • NationalSecurityAgency/seabee
  • AyagamiDev/ayagami
  • oxidecomputer/idolatry
  • jiangzhe/doradb
  • heinrich5991/libtw2
  • rkyv/rend
  • rust-osdev/fuse-abi
  • rust-osdev/endian-num
  • DevExzh/litchi
  • aranya-project/aranya-core
  • lohvht/azothacore-rs
  • platform-system-interface/android-image
  • sivadeilra/pow2
  • zhengxinchang/isopedia
  • platform-system-interface/intel_fw
  • kdanecki/uma-filesystem
  • moehr1z/hermit-rs
  • rcore-os/virtio-drivers
  • google/safe-mmio
  • microsoft/pdb-rs
  • chipsalliance/caliptra-dpe
  • birkenfeld/ads-rs
  • camshaft/codec
  • RibirX/Ribir
  • Systemcluster/wrappe
  • encounter/nod
  • cbiffle/catibo
  • KOBA789/qp
  • KOBA789/relly
  • willglynn/taptap
  • worldfnd/whir
  • monadplus/rust-playground
  • google/percore

The largest type I found is coconut-svsm/svsm's cpuarch::VMSA, with 120 fields:

#[repr(C, packed)]
#[derive(Debug, FromBytes)]
pub struct VMSA {
    // ...
}
Dominant language
Rust
Stars
2.6k
Forks
194
Avg merge
18h 15m
Merged PRs (30d)
14

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from google/zerocopy

All issues in google/zerocopy

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.