News for hackers. Stuff that matters.
Re:Optimizing Rust Struct Size by eddyb on Saturday April 15, 2017 @07:01PM (#14123330)
> now needs 'repr(C)'

It always has, we lint for this, and the Rust struct layout has been officially left unspecified (making assumptions based on it UB) from before 1.0, anyway.

> One would think that would be 'repr("C")', since here, "C" is neither a reserved word nor a variable, but, whatever.

Neither is 'repr' - they're both just identifiers in an attribute. #[attr("string literal")] is newer and still unstable (as part of the new macro system).

The bit array packing is something we've wanted to do for a long while, but it requires an opt-in along the lines of "disallow taking references to any (sub-byte) fields".

#[repr(packed)] is the same as the C equivalent, be it attribute or pragma, in that it only removes alignment padding and does nothing to booleans.

There are no comments on this comment yet.