-
Notifications
You must be signed in to change notification settings - Fork 121
Open
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; also link to Support mid-level byte slice and buffer operations #1315
- If two slice DSTs have the same slice offset, element size, and alignment, then we can support
transmute_ref!
andtransmute_mut!
for these types - just need to figure out how to encode all of these in the type system (e.g. associated types onKnownLayout
) - As part of a broader trend towards teaching zerocopy to express more powerful transmutations, could we add
trait AsInitialized<T>
? We could use it to replace the existingSrc: IntoBytes
bound intransmute!
,try_transmute!
, etc - Look at the nolife crate's API for inspiration
- Look at the binary_layout crate's API for inspiration
- Add method to
Ref
to change the type parameter (ie, perform a transmutation); we could use this to makenew_sized
a thin wrapper aroundnew
- Support stdlib's new generic
NonZero<T>
- Add a trait that marks
T
for whichsize_of::<T>() == size_of::<Option<T>>()
(see Support generic NonZero<T> #2255)
- Add a trait that marks
- Support transmuting
T
toMaybeUninit<T>
(or maybe evenMaybeUninit<U>
) even whenT: ?IntoBytes
- Once
generic_const_exprs
andassociated_const_equality
are stabilized, we can useKnownLayout::LAYOUT
to guarantee layout equality, supporting both size equality and slice DST equality (e.g.,T: KnownLayout, U: KnownLayout<LAYOUT = {T::LAYOUT}>
); see playground example - Add
Unalign::replace
orswap
(which returns the original) and maybe deprecateUnalign::set
. Strictly more powerful.
Safety
- Audit for
&slice[0] as *const
per rust-lang/unsafe-code-guidelines#134 - Audit for
&mut as *const
per rust-lang/rust#56604 - see also rust-lang/clippy#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 in CI?
Performance
- When deriving
TryFromBytes
, if we're deriving it thanks to#[derive(FromBytes)]
, emit an emptyis_bit_valid
impl; this will be more optimizable, and should cut down on compile times - cargo-llvm-lines
Developer experience
- Consider using
cargo nextest
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)
- Looks like GitHub might eventually support this natively
- Feature request: Partial upload/deploy actions/deploy-pages#349
- Here's a suggestion for working around the current issue
- Consider using
cargo release
- Consider using larger GitHub Actions 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.
- Only generate roll PRs (for pinned stable and nightly toolchains) on week days
- Allow setting repository-wide "vacation mode" that causes rollers to pause
Documentation
- Write documentation post on zerocopy's values
- 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)? - 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/"
- Make zerocopy-derive docs link to zerocopy traits
Testing
- Use
kani::cover!
(e.g. to more thoroughly test Derive trivialis_bit_valid
when possible #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<Bytes<'a>>
- Put lints in
Cargo.toml
once that's stable on our MSRV: Tracking Issue for[lints]
table RFC 3389 rust-lang/cargo#12115 - Use
freeze
API once it lands/stabilizes: RFC: Addfreeze
intrinsic and related library functions rust-lang/rfcs#3605 - Use inline
const
in zerocopy? Stabilise inline_const rust-lang/rust#104087 - Any use for return-position impl trait in traits (RPITT) in zerocopy or downstream libraries like packet?
- Any use for variadic generics?
- Any use for
slice_flatten
?
Done
- Add GitHub Action - to be triggered manually - that submits a PR that releases a new zerocopy version
- Publish cargo docs (with private/hidden items documented) for
main
at google.github.io/zerocopy
Metadata
Metadata
Assignees
Labels
No labels