From 647b4a4deb8de06cdc375187ecaf29ebeaa65f98 Mon Sep 17 00:00:00 2001 From: varkor Date: Thu, 6 Jun 2019 01:55:57 +0100 Subject: [PATCH] Add test for const generics struct constructor --- .../const-generics/array-wrapper-struct-ctor.rs | 15 +++++++++++++++ .../array-wrapper-struct-ctor.stderr | 6 ++++++ 2 files changed, 21 insertions(+) create mode 100644 src/test/ui/const-generics/array-wrapper-struct-ctor.rs create mode 100644 src/test/ui/const-generics/array-wrapper-struct-ctor.stderr diff --git a/src/test/ui/const-generics/array-wrapper-struct-ctor.rs b/src/test/ui/const-generics/array-wrapper-struct-ctor.rs new file mode 100644 index 0000000000000..d83846fcf88d4 --- /dev/null +++ b/src/test/ui/const-generics/array-wrapper-struct-ctor.rs @@ -0,0 +1,15 @@ +// run-pass + +#![feature(const_generics)] +//~^ WARN the feature `const_generics` is incomplete and may cause the compiler to crash + +struct ArrayStruct { + data: [T; N], +} + +struct ArrayTuple([T; N]); + +fn main() { + let _ = ArrayStruct { data: [0u32; 8] }; + let _ = ArrayTuple([0u32; 8]); +} diff --git a/src/test/ui/const-generics/array-wrapper-struct-ctor.stderr b/src/test/ui/const-generics/array-wrapper-struct-ctor.stderr new file mode 100644 index 0000000000000..bd18264c1637d --- /dev/null +++ b/src/test/ui/const-generics/array-wrapper-struct-ctor.stderr @@ -0,0 +1,6 @@ +warning: the feature `const_generics` is incomplete and may cause the compiler to crash + --> $DIR/array-wrapper-struct-ctor.rs:3:12 + | +LL | #![feature(const_generics)] + | ^^^^^^^^^^^^^^ +