`BitSlice` or a sound way to implement one
Rust Internals [Unofficial]
May 2, 2026
I would really like to just have a u1 type where Vec<u1> and [u1] behave as you'd expect. For this to be possible without breaking everything you'd need at least:
- A new
BitSizedbuilt-in trait whereSized: BitSized. - For
u1to not implementSized(because it doesn't have a size expressible in bytes). - To relax the bounds on
Vec<T>and[T]to just beT: BitSized.
I don't know how feasible this is on the codegen side of things though, eg. if you have two &mut [u1] that overlap the same byte.
Discussion in the ATmosphere