(no title)
Rusky
|
3 months ago
Hypothetically Rust could make `Mutex<InnerBlah>` work with just two bits in the same way it makes `Option<&T>` the same size as `&T`. Annotate `InnerBlah` with the information about which bits are available and let `Mutex` use them.
scottlamb|3 months ago
[1] e.g. https://internals.rust-lang.org/t/pre-rfc-allow-array-stride...
timClicks|3 months ago
In principle, you Rust could create something like std::num::NonZero and its corresponding sealed trait ZeroablePrimitive to mark that two bits are unused. But that doesn't exist yet as far as I know.
Rusky|3 months ago
Also aspirations to use pattern types for this sort of thing: https://github.com/rust-lang/rust/issues/135996