1 #![warn(clippy::trailing_empty_array)]
2 #![feature(const_generics_defaults)]
12 first_and_last: [usize; 0],
15 struct GenericArrayType<T> {
21 struct OnlyAnotherAttribute {
27 struct OnlyADeriveAttribute {
32 const ZERO: usize = 0;
33 struct ZeroSizedWithConst {
38 #[allow(clippy::eq_op)]
39 const fn compute_zero() -> usize {
42 struct ZeroSizedWithConstFunction {
44 last: [usize; compute_zero()],
47 const fn compute_zero_from_arg(x: usize) -> usize {
50 struct ZeroSizedWithConstFunction2 {
52 last: [usize; compute_zero_from_arg(1)],
55 struct ZeroSizedArrayWrapper([usize; 0]);
57 struct TupleStruct(i32, [usize; 0]);
88 struct OnlyFieldWithReprC {
89 first_and_last: [usize; 0],
92 struct NonZeroSizedArray {
99 zero_sized: [usize; 0],
103 const ONE: usize = 1;
104 struct NonZeroSizedWithConst {
111 struct AlsoADeriveAttribute {
118 struct AlsoAnotherAttribute {
140 #[repr(C, align(64))]
146 // NOTE: because of https://doc.rust-lang.org/stable/reference/type-layout.html#primitive-representation-of-enums-with-fields and I'm not sure when in the compilation pipeline that would happen
148 enum DontLintAnonymousStructsFromDesuraging {
151 C { x: u32, y: [u64; 0] },
155 struct TupleStructReprC(i32, [usize; 0]);
157 type NamedTuple = (i32, [usize; 0]);
159 #[rustfmt::skip] // [rustfmt#4995](https://github.com/rust-lang/rustfmt/issues/4995)
160 struct ConstParamZeroDefault<const N: usize = 0> {
165 struct ConstParamNoDefault<const N: usize> {
171 struct ConstParamNonZeroDefault<const N: usize = 1> {
176 struct TwoGenericParams<T, const N: usize> {
181 type A = ConstParamZeroDefault;
182 type B = ConstParamZeroDefault<0>;
183 type C = ConstParamNoDefault<0>;
184 type D = ConstParamNonZeroDefault<0>;