about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/test/ui/const-generics/fn-taking-const-generic-array.rs16
-rw-r--r--src/test/ui/const-generics/fn-taking-const-generic-array.stderr6
2 files changed, 22 insertions, 0 deletions
diff --git a/src/test/ui/const-generics/fn-taking-const-generic-array.rs b/src/test/ui/const-generics/fn-taking-const-generic-array.rs
new file mode 100644
index 00000000000..d3d17cca4da
--- /dev/null
+++ b/src/test/ui/const-generics/fn-taking-const-generic-array.rs
@@ -0,0 +1,16 @@
+// run-pass
+
+#![feature(const_generics)]
+//~^ WARN the feature `const_generics` is incomplete and may cause the compiler to crash
+
+use std::fmt::Display;
+
+fn print_slice<T: Display, const N: usize>(slice: &[T; N]) {
+    for x in slice.iter() {
+        println!("{}", x);
+    }
+}
+
+fn main() {
+    print_slice(&[1, 2, 3]);
+}
diff --git a/src/test/ui/const-generics/fn-taking-const-generic-array.stderr b/src/test/ui/const-generics/fn-taking-const-generic-array.stderr
new file mode 100644
index 00000000000..36704128325
--- /dev/null
+++ b/src/test/ui/const-generics/fn-taking-const-generic-array.stderr
@@ -0,0 +1,6 @@
+warning: the feature `const_generics` is incomplete and may cause the compiler to crash
+  --> $DIR/fn-taking-const-generic-array.rs:3:12
+   |
+LL | #![feature(const_generics)]
+   |            ^^^^^^^^^^^^^^
+