0

Warn on structs with a trailing zero-sized array but no `repr` attribute by nham...

 2 years ago
source link: https://github.com/rust-lang/rust-clippy/pull/7838
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Copy link

Contributor

nhamovitz commented 10 days ago

edited

Closes #2868

changelog: Implement [`trailing_empty_array`], which warns if a struct is defined where the last field is a zero-sized array but there are no repr attributes. Zero-sized arrays aren't very useful in Rust itself, so such a struct is likely being created to pass to C code or in some other situation where control over memory layout matters. Either way, a repr attribute is needed.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK