From 81345669887b53c63d0d6a50721e640197d90c66 Mon Sep 17 00:00:00 2001 From: Alex Macleod Date: Sun, 23 Oct 2022 20:32:40 +0000 Subject: Remove `src/docs` --- 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