about summary refs log tree commit diff
path: root/src/docs/trailing_empty_array.txt
diff options
context:
space:
mode:
authorPhilipp Krones <hello@philkrones.com>2022-11-21 20:34:47 +0100
committerPhilipp Krones <hello@philkrones.com>2022-11-21 20:51:52 +0100
commit46c5a5d234f13dcf4bb4cf4241b2addedbf0be14 (patch)
tree56726625e55224ecb09ed11f509a964507b9c333 /src/docs/trailing_empty_array.txt
parent3597ed5a099488aa77caf444106a0550b7e5d2e8 (diff)
downloadrust-46c5a5d234f13dcf4bb4cf4241b2addedbf0be14.tar.gz
rust-46c5a5d234f13dcf4bb4cf4241b2addedbf0be14.zip
Merge commit 'f4850f7292efa33759b4f7f9b7621268979e9914' into clippyup
Diffstat (limited to 'src/docs/trailing_empty_array.txt')
-rw-r--r--src/docs/trailing_empty_array.txt22
1 files changed, 0 insertions, 22 deletions
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