11error: trailing zero-sized array in a struct which is not marked `#[repr(C)]`
2- --> $DIR/trailing_zero_sized_array_without_repr_c.rs:4 :1
2+ --> $DIR/trailing_zero_sized_array_without_repr_c.rs:5 :1
33 |
44LL | / struct RarelyUseful {
55LL | | field: i32,
@@ -8,87 +8,76 @@ LL | | }
88 | |_^
99 |
1010 = note: `-D clippy::trailing-zero-sized-array-without-repr-c` implied by `-D warnings`
11- help: try annotating the struct definition with `#[repr(C)]` (or another `repr` attribute):
12- |
13- LL + #[repr(C)]
14- LL + struct RarelyUseful {
15- LL + field: i32,
16- LL + last: [usize; 0],
17- LL + }
18- |
11+ = help: consider annotating the struct definition with `#[repr(C)]` (or another `repr` attribute)
1912
2013error: trailing zero-sized array in a struct which is not marked `#[repr(C)]`
21- --> $DIR/trailing_zero_sized_array_without_repr_c.rs:15 :1
14+ --> $DIR/trailing_zero_sized_array_without_repr_c.rs:10 :1
2215 |
23- LL | / struct OnlyFieldIsZeroSizeArray {
16+ LL | / struct OnlyField {
2417LL | | first_and_last: [usize; 0],
2518LL | | }
2619 | |_^
2720 |
28- help: try annotating the struct definition with `#[repr(C)]` (or another `repr` attribute):
29- |
30- LL + #[repr(C)]
31- LL + struct OnlyFieldIsZeroSizeArray {
32- LL + first_and_last: [usize; 0],
33- LL + }
34- |
21+ = help: consider annotating the struct definition with `#[repr(C)]` (or another `repr` attribute)
3522
3623error: trailing zero-sized array in a struct which is not marked `#[repr(C)]`
37- --> $DIR/trailing_zero_sized_array_without_repr_c.rs:19 :1
24+ --> $DIR/trailing_zero_sized_array_without_repr_c.rs:14 :1
3825 |
3926LL | / struct GenericArrayType<T> {
4027LL | | field: i32,
4128LL | | last: [T; 0],
4229LL | | }
4330 | |_^
4431 |
45- help: try annotating the struct definition with `#[repr(C)]` (or another `repr` attribute):
32+ = help: consider annotating the struct definition with `#[repr(C)]` (or another `repr` attribute)
33+
34+ error: trailing zero-sized array in a struct which is not marked `#[repr(C)]`
35+ --> $DIR/trailing_zero_sized_array_without_repr_c.rs:19:1
4636 |
47- LL + #[repr(C)]
48- LL + struct GenericArrayType<T> {
49- LL + field: i32,
50- LL + last: [T; 0],
51- LL + }
37+ LL | / #[must_use]
38+ LL | | struct OnlyAnotherAttributeMustUse {
39+ LL | | field: i32,
40+ LL | | last: [usize; 0],
41+ LL | | }
42+ | |_^
5243 |
44+ = help: consider annotating the struct definition with `#[repr(C)]` (or another `repr` attribute)
5345
5446error: trailing zero-sized array in a struct which is not marked `#[repr(C)]`
55- --> $DIR/trailing_zero_sized_array_without_repr_c.rs:30 :1
47+ --> $DIR/trailing_zero_sized_array_without_repr_c.rs:28 :1
5648 |
57- LL | / struct ZeroSizedFromExternalConst {
49+ LL | / struct OnlyAnotherAttributeDerive {
5850LL | | field: i32,
59- LL | | last: [usize; ZERO ],
51+ LL | | last: [usize; 0 ],
6052LL | | }
6153 | |_^
6254 |
63- help: try annotating the struct definition with `#[repr(C)]` (or another `repr` attribute):
55+ = help: consider annotating the struct definition with `#[repr(C)]` (or another `repr` attribute)
56+
57+ error: trailing zero-sized array in a struct which is not marked `#[repr(C)]`
58+ --> $DIR/trailing_zero_sized_array_without_repr_c.rs:34:1
6459 |
65- LL + #[repr(C)]
66- LL + struct ZeroSizedFromExternalConst {
67- LL + field: i32 ,
68- LL + last: [usize; ZERO],
69- LL + }
60+ LL | / struct ZeroSizedWithConst {
61+ LL | | field: i32,
62+ LL | | last: [usize; ZERO] ,
63+ LL | | }
64+ | |_^
7065 |
66+ = help: consider annotating the struct definition with `#[repr(C)]` (or another `repr` attribute)
7167
7268error: trailing zero-sized array in a struct which is not marked `#[repr(C)]`
73- --> $DIR/trailing_zero_sized_array_without_repr_c.rs:45 :1
69+ --> $DIR/trailing_zero_sized_array_without_repr_c.rs:43 :1
7470 |
75- LL | / struct UsingFunction {
71+ LL | / struct ZeroSizedWithConstFunction {
7672LL | | field: i32,
7773LL | | last: [usize; compute_zero()],
7874LL | | }
7975 | |_^
8076 |
81- help: try annotating the struct definition with `#[repr(C)]` (or another `repr` attribute):
82- |
83- LL + #[repr(C)]
84- LL + struct UsingFunction {
85- LL + field: i32,
86- LL + last: [usize; compute_zero()],
87- LL + }
88- |
77+ = help: consider annotating the struct definition with `#[repr(C)]` (or another `repr` attribute)
8978
9079error: trailing zero-sized array in a struct which is not marked `#[repr(C)]`
91- --> $DIR/trailing_zero_sized_array_without_repr_c.rs:94 :1
80+ --> $DIR/trailing_zero_sized_array_without_repr_c.rs:48 :1
9281 |
9382LL | / struct LotsOfFields {
9483LL | | f1: u32,
@@ -99,15 +88,7 @@ LL | | last: [usize; 0],
9988LL | | }
10089 | |_^
10190 |
102- help: try annotating the struct definition with `#[repr(C)]` (or another `repr` attribute):
103- |
104- LL + #[repr(C)]
105- LL + struct LotsOfFields {
106- LL + f1: u32,
107- LL + f2: u32,
108- LL + f3: u32,
109- LL + f4: u32,
110- ...
91+ = help: consider annotating the struct definition with `#[repr(C)]` (or another `repr` attribute)
11192
112- error: aborting due to 6 previous errors
93+ error: aborting due to 8 previous errors
11394
0 commit comments