From 46c5a5d234f13dcf4bb4cf4241b2addedbf0be14 Mon Sep 17 00:00:00 2001 From: Philipp Krones Date: Mon, 21 Nov 2022 20:34:47 +0100 Subject: Merge commit 'f4850f7292efa33759b4f7f9b7621268979e9914' into clippyup --- src/docs/trailing_empty_array.txt | 22 ---------------------- 1 file changed, 22 deletions(-) delete mode 100644 src/docs/trailing_empty_array.txt (limited to 'src/docs/trailing_empty_array.txt') diff --git a/src/docs/trailing_empty_array.txt b/src/docs/trailing_empty_array.txt deleted file mode 100644 index db1908cc96d..00000000000 --- a/src/docs/trailing_empty_array.txt +++ /dev/null @@ -1,22 +0,0 @@ -### What it does -Displays a warning when a struct with a trailing zero-sized array is declared without a `repr` attribute. - -### Why is this bad? -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 (for example, in conjunction with manual allocation to make it easy to compute the offset of the array). Either way, `#[repr(C)]` (or another `repr` attribute) is needed. - -### Example -``` -struct RarelyUseful { - some_field: u32, - last: [u32; 0], -} -``` - -Use instead: -``` -#[repr(C)] -struct MoreOftenUseful { - some_field: usize, - last: [u32; 0], -} -``` \ No newline at end of file -- cgit 1.4.1-3-g733a5