diff options
Diffstat (limited to 'tests/ui/trailing_empty_array.rs')
| -rw-r--r-- | tests/ui/trailing_empty_array.rs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/ui/trailing_empty_array.rs b/tests/ui/trailing_empty_array.rs index 928475b5f35..3d06c262168 100644 --- a/tests/ui/trailing_empty_array.rs +++ b/tests/ui/trailing_empty_array.rs @@ -3,33 +3,39 @@ // Do lint: struct RarelyUseful { + //~^ ERROR: trailing zero-sized array in a struct which is not marked with a `repr` attrib field: i32, last: [usize; 0], } struct OnlyField { + //~^ ERROR: trailing zero-sized array in a struct which is not marked with a `repr` attrib first_and_last: [usize; 0], } struct GenericArrayType<T> { + //~^ ERROR: trailing zero-sized array in a struct which is not marked with a `repr` attrib field: i32, last: [T; 0], } #[must_use] struct OnlyAnotherAttribute { + //~^ ERROR: trailing zero-sized array in a struct which is not marked with a `repr` attrib field: i32, last: [usize; 0], } #[derive(Debug)] struct OnlyADeriveAttribute { + //~^ ERROR: trailing zero-sized array in a struct which is not marked with a `repr` attrib field: i32, last: [usize; 0], } const ZERO: usize = 0; struct ZeroSizedWithConst { + //~^ ERROR: trailing zero-sized array in a struct which is not marked with a `repr` attrib field: i32, last: [usize; ZERO], } @@ -39,6 +45,7 @@ const fn compute_zero() -> usize { (4 + 6) - (2 * 5) } struct ZeroSizedWithConstFunction { + //~^ ERROR: trailing zero-sized array in a struct which is not marked with a `repr` attrib field: i32, last: [usize; compute_zero()], } @@ -47,15 +54,19 @@ const fn compute_zero_from_arg(x: usize) -> usize { x - 1 } struct ZeroSizedWithConstFunction2 { + //~^ ERROR: trailing zero-sized array in a struct which is not marked with a `repr` attrib field: i32, last: [usize; compute_zero_from_arg(1)], } struct ZeroSizedArrayWrapper([usize; 0]); +//~^ ERROR: trailing zero-sized array in a struct which is not marked with a `repr` attrib struct TupleStruct(i32, [usize; 0]); +//~^ ERROR: trailing zero-sized array in a struct which is not marked with a `repr` attrib struct LotsOfFields { + //~^ ERROR: trailing zero-sized array in a struct which is not marked with a `repr` attrib f1: u32, f2: u32, f3: u32, |
