about summary refs log tree commit diff
diff options
context:
space:
mode:
authorvarkor <github@varkor.com>2019-06-06 01:55:57 +0100
committervarkor <github@varkor.com>2019-06-07 10:18:19 +0100
commit647b4a4deb8de06cdc375187ecaf29ebeaa65f98 (patch)
tree803eedb6fc13f55ff4d732252bbb2208c0b0f37e
parenta0e3e9ab9d50c74e51a81d566c941dfee6733ce5 (diff)
downloadrust-647b4a4deb8de06cdc375187ecaf29ebeaa65f98.tar.gz
rust-647b4a4deb8de06cdc375187ecaf29ebeaa65f98.zip
Add test for const generics struct constructor
-rw-r--r--src/test/ui/const-generics/array-wrapper-struct-ctor.rs15
-rw-r--r--src/test/ui/const-generics/array-wrapper-struct-ctor.stderr6
2 files changed, 21 insertions, 0 deletions
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 00000000000..d83846fcf88
--- /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<T, const N: usize> {
+    data: [T; N],
+}
+
+struct ArrayTuple<T, const N: usize>([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 00000000000..bd18264c163
--- /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)]
+   |            ^^^^^^^^^^^^^^
+