3 ms·
I think you meant to link to https://lwn.net/Articles/658511/ https://lwn.net/Articles/658511/ Why can't we just alias the storage to something different under
by wyldfire 11y ago
I think you meant to link to https://lwn.net/Articles/658511/ https://lwn.net/Articles/658511/
Why can't we just alias the storage to something different underneath? How is there a "hard" requirement? Unless it's difficult/impossible to make the representation align correctly without the same semantics?
- JoshTriplett 11y agoThe main data structure for /dev/kvm is `struct kvm_run`, which includes a massive union. There are also unions spread out across the rest of the API; half the structures in the API have some kind of union in them. It would be possible to make that work using unsafe operations like `std::mem::transmute` and careful manual pointer offsets, but that would eliminate much of the benefit of doing this in Rust in the first place.