about summary refs log tree commit diff
path: root/src/test/ui/const-generics/min_const_generics/generic-function-call-in-array-length.rs
diff options
context:
space:
mode:
authorvarkor <github@varkor.com>2020-10-02 02:21:15 +0100
committervarkor <github@varkor.com>2020-10-02 02:22:01 +0100
commit1db05e032db798b3162926ee4b72072d3c4de56f (patch)
tree9affc7d1b0c5c1ec3c2bb8677370c427c768e352 /src/test/ui/const-generics/min_const_generics/generic-function-call-in-array-length.rs
parent0801263279bbd44b7dbe88d5039a6b810a037f3b (diff)
downloadrust-1db05e032db798b3162926ee4b72072d3c4de56f.tar.gz
rust-1db05e032db798b3162926ee4b72072d3c4de56f.zip
Add various `min_const_generics` regression tests
Diffstat (limited to 'src/test/ui/const-generics/min_const_generics/generic-function-call-in-array-length.rs')
-rw-r--r--src/test/ui/const-generics/min_const_generics/generic-function-call-in-array-length.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/test/ui/const-generics/min_const_generics/generic-function-call-in-array-length.rs b/src/test/ui/const-generics/min_const_generics/generic-function-call-in-array-length.rs
new file mode 100644
index 00000000000..c52f4022942
--- /dev/null
+++ b/src/test/ui/const-generics/min_const_generics/generic-function-call-in-array-length.rs
@@ -0,0 +1,11 @@
+#![feature(min_const_generics)]
+
+const fn foo(n: usize) -> usize { n * 2 }
+
+fn bar<const N: usize>() -> [u32; foo(N)] {
+    //~^ ERROR generic parameters must not be used inside of non trivial constant values
+    [0; foo(N)]
+    //~^ ERROR generic parameters must not be used inside of non trivial constant values
+}
+
+fn main() {}