about summary refs log tree commit diff
diff options
context:
space:
mode:
authorvarkor <github@varkor.com>2019-04-17 19:31:04 +0100
committervarkor <github@varkor.com>2019-05-01 23:11:19 +0100
commit67176f751b03404112cc7f9e25ea3081d834f144 (patch)
treecc659f38994031e5b262c3c721e522d8af018468
parent5cf45bc27abd8169ea0fd3629000028c10a7aa1a (diff)
downloadrust-67176f751b03404112cc7f9e25ea3081d834f144.tar.gz
rust-67176f751b03404112cc7f9e25ea3081d834f144.zip
Add `const-types` test
-rw-r--r--src/test/ui/const-generics/const-types.rs16
-rw-r--r--src/test/ui/const-generics/const-types.stderr6
2 files changed, 22 insertions, 0 deletions
diff --git a/src/test/ui/const-generics/const-types.rs b/src/test/ui/const-generics/const-types.rs
new file mode 100644
index 00000000000..11757cd588d
--- /dev/null
+++ b/src/test/ui/const-generics/const-types.rs
@@ -0,0 +1,16 @@
+// run-pass
+
+#![feature(const_generics)]
+//~^ WARN the feature `const_generics` is incomplete and may cause the compiler to crash
+
+#[allow(dead_code)]
+
+struct ConstArray<T, const LEN: usize> {
+    array: [T; LEN],
+}
+
+fn main() {
+    let arr = ConstArray::<i32, 8> {
+        array: [0; 8],
+    };
+}
diff --git a/src/test/ui/const-generics/const-types.stderr b/src/test/ui/const-generics/const-types.stderr
new file mode 100644
index 00000000000..fbf5d537541
--- /dev/null
+++ b/src/test/ui/const-generics/const-types.stderr
@@ -0,0 +1,6 @@
+warning: the feature `const_generics` is incomplete and may cause the compiler to crash
+  --> $DIR/const-types.rs:3:12
+   |
+LL | #![feature(const_generics)]
+   |            ^^^^^^^^^^^^^^
+