Re:Announcing Rust 1.19
by Manishearth on Friday July 21, 2017 @02:44AM
(#14818544)
Gecko (and many other large C++ programs that care about memory usage of certain heap allocated types) uses bitfields often enough, and we've had to teach bindgen how to generate bitfields so that we can access them from Rust.
Re:Announcing Rust 1.19
by adrianratnapala on Tuesday July 25, 2017 @07:03PM
(#14852594)
Were these intended as part of an external interface for Gecko? In which case I would say using bitfields (as opposed to explicit masks) was a mistake.
But yes, I can imagine that for Mozilla there is a need to mix Rust and C++ right inside an application at boundaries that are not usually considered external, in which case all kinds of non-portable C constructs are acceptable.
Re:Announcing Rust 1.19
by JoshTriplett on Friday July 21, 2017 @01:46AM
(#14818332)
> A kind of similar issue appears even with enums, because it is hard to guess the size of the integer that a given enum is implemented with.
True; fortunately, Rust has a means of declaring the size of an enum, with #[repr(u8)] and similar. But you do have to figure out the size of the C enum.
A kind of similar issue appears even with enums, because it is hard to guess the size of the integer that a given enum is implemented with. This is why it some not to use C enums in public interfaces to libraries.