Someday Maybe
- Dominant language
- Rust
- Stars
- 2.6k
- Forks
- 179
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 29
Description
*This issue tracks ideas which we might want to tackle some day, but which don't have enough detail to warrant their own separate issues.*
## Feature additions
- [ ] Track all parser ideas somewhere in the zerocopy repo, including [this prototype](https://github.com/google/zerocopy/pull/356); also link to #1315
- [ ] If two slice DSTs have the same slice offset, element size, and alignment, then we can support `transmute_ref!` and `transmute_mut!` for these types - just need to figure out how to encode all of these in the type system (e.g. associated types on `KnownLayout`)
- [ ] As part of a broader trend towards teaching zerocopy to express more powerful transmutations, could we add `trait AsInitialized`? We could use it to replace the existing `Src: IntoBytes` bound in `transmute!`, `try_transmute!`, etc
- [ ] Look at the [nolife crate](https://docs.rs/nolife/0.4.0/nolife/)'s API for inspiration
- [ ] Look at the [binary_layout crate](https://docs.rs/binary-layout/latest/binary_layout/)'s API for inspiration
- [ ] Add method to `Ref` to change the type parameter (ie, perform a transmutation); we could use this to make `new_sized` a thin wrapper around `new`
- [ ] Support stdlib's new [generic `NonZero`](https://doc.rust-lang.org/nightly/std/num/struct.NonZero.html)
- [ ] Add a trait that marks `T` for which `size_of::() == size_of::>()` (see #2255)
- [ ] Support transmuting `T` to `MaybeUninit` (or maybe even `MaybeUninit`) even when `T: ?IntoBytes`
- [ ] Once `generic_const_exprs` and `associated_const_equality` are stabilized, we can use `KnownLayout::LAYOUT` to guarantee layout equality, supporting both size equality and slice DST equality (e.g., `T: KnownLayout, U: KnownLayout`); see [playground example](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=6fd120b2d4792be7e25b9bb48e0484b9)
- [ ] Add `Unalign::replace` or `swap` (which returns the original) and maybe deprecate `Unalign::set`. Strictly more powerful.
## Safety
- [ ] Audit for `&slice[0] as *const` per [rust-lang/unsafe-code-guidelines#134](https://github.com/rust-lang/unsafe-code-guidelines/issues/134)
- [ ] Audit for `&mut as *const` per [rust-lang/rust#56604](https://github.com/rust-lang/rust/issues/56604) - see also [rust-lang/clippy#12791](https://github.com/rust-lang/rust-clippy/issues/12791)
- [ ] In `Ptr`'s internal invariants, do we need to separately say that the pointer is derived from a valid allocation *and* that it has provenance for that allocation? Is the latter alone sufficient?
- [ ] Use [Rudra](https://github.com/sslab-gatech/Rudra) in CI?
## Performance
- [x] When deriving `TryFromBytes`, if we're deriving it thanks to `#[derive(FromBytes)]`, emit an empty `is_bit_valid` impl; this will be more optimizable, and should cut down on compile times
- #1303
- [ ] [cargo-llvm-lines](https://crates.io/crates/cargo-llvm-lines)
## Developer experience
- [x] Only generate roll PRs (for pinned stable and nightly toolchains) on week days
- [ ] Consider using [`cargo nextest`](https://nexte.st/) to speed up CI execution times
- [ ] Cargo docs published to google.github.io/zerocopy could include link to the commit that generated it
- One idea for how to do this: programmatically edit the crate-root doc comment with a link
- Maybe publish each commit's docs in a subdirectory named for that commit's hash so we have a historical record of all documentation?
- [ ] Publish cargo docs to google.github.io/zerocopy for every PR (see [this StackOverflow question](https://stackoverflow.com/questions/78460845/edit-part-of-github-pages-via-action-without-overwriting))
- Looks like GitHub might eventually [support this natively](https://github.com/actions/deploy-pages/pull/61)
- https://github.com/actions/deploy-pages/issues/349
- [Here's a suggestion](https://github.com/actions/deploy-pages/issues/349#issuecomment-2676027614) for working around the current issue
- [ ] Consider using `cargo release`
- [ ] Consider using [larger GitHub Actions runners](https://docs.github.com/en/actions/using-github-hosted-runners/about-larger-runners)
- [ ] In CI, confirm that MSRV is lower than any version we use for version detection. This will naturally trigger us to clean up the codebase when we bump MSRV.
- [ ] Allow setting repository-wide "vacation mode" that causes rollers to pause
## Documentation
- [x] Use permalinks when quoting Rust documentation; e.g., "https://doc.rust-lang.org/1.54.0/std/" instead of "https://doc.rust-lang.org/stable/std/"
- [ ] Write [documentation](https://github.com/google/zerocopy/discussions/categories/documentation) post on zerocopy's [values](https://www.youtube.com/watch?v=Xhx970_JKX4)
- [ ] Be consistent about our use of "interpret" vs "reinterpret" in doc comments
- [ ] Compile for multiple targets on docs.rs using the `package.metadata.docs.rs.targets` `Cargo.toml` key (see e.g. [usage in syn](https://github.com/dtolnay/syn/blob/e2abd39d334acce72553e0ad9b8c146e9b7732f3/Cargo.toml#L70))?
- [ ] Make zerocopy-derive docs link to zerocopy traits
## Testing
- [ ] Use [`kani::cover!`](https://model-checking.github.io/kani-verifier-blog/2023/01/30/reachability-and-sanity-checking-with-kani-cover.html) (e.g. to more thoroughly test #1303)
- [ ] Test our tests using mutagen
## Community engagement and outside contributions
- [ ] Post research projects on edu Zulip
## Miscellaneous
- [ ] Check for missing copyright header comments in CI
- [ ] Use invariant lifetimes to achieve a sort of dependent typing? E.g., here's a function where the returned byte array is guaranteed to be `n` bytes long:
- `fn take_bytes<'a>(&mut self, n: Usize<'a>) -> Option>`
- [ ] Put lints in `Cargo.toml` once that's stable on our MSRV: https://github.com/rust-lang/cargo/issues/12115
- [ ] Use `freeze` API once it lands/stabilizes: https://github.com/rust-lang/rfcs/pull/3605
- [ ] Use inline `const` in zerocopy? https://github.com/rust-lang/rust/pull/104087
- [ ] Any use for return-position impl trait in traits (RPITT) in zerocopy or downstream libraries like packet?
- [ ] Any use for [variadic generics](https://poignardazur.github.io/2024/05/25/report-on-rustnl-variadics/)?
- [ ] Any use for [`slice_flatten`](https://github.com/rust-lang/rust/issues/95629)?
## Done
- [x] Add GitHub Action - to be triggered manually - that submits a PR that releases a new zerocopy version
- #1172
- [x] Publish cargo docs (with private/hidden items documented) for `main` at google.github.io/zerocopy
- Done: #1227
Contributor guide
Assessment
This issue has not been assessed yet.