about summary refs log tree commit diff
path: root/src/test/ui/const-generics/generic-function-call-in-array-length.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2020-10-05 02:49:51 +0000
committerbors <bors@rust-lang.org>2020-10-05 02:49:51 +0000
commitefbaa413061c2a6e52f06f00a60ee7830fcf3ea5 (patch)
treed728ec6e5c6bbcaaf0accc89b53a176515718745 /src/test/ui/const-generics/generic-function-call-in-array-length.rs
parentced813fec0fb9e883906f18b76d618baf9f5bc08 (diff)
parent9dbc9ed870a3956d938c823338ac8943377845e8 (diff)
downloadrust-efbaa413061c2a6e52f06f00a60ee7830fcf3ea5.tar.gz
rust-efbaa413061c2a6e52f06f00a60ee7830fcf3ea5.zip
Auto merge of #77557 - Dylan-DPC:rollup-aib9ptp, r=Dylan-DPC
Rollup of 11 pull requests

Successful merges:

 - #75853 (Use more intra-doc-links in `core::fmt`)
 - #75928 (Remove trait_selection error message in specific case)
 - #76329 (Add check for doc alias attribute at crate level)
 - #77219 (core::global_allocator docs link to std::alloc::GlobalAlloc)
 - #77395 (BTreeMap: admit the existence of leaf edges in comments)
 - #77407 (Improve build-manifest to work with the improved promote-release)
 - #77426 (Include scope id in SocketAddrV6::Display)
 - #77439 (Fix missing diagnostic span for `impl Trait` with const generics, and add various tests for `min_const_generics` and `const_generics`)
 - #77471 (BTreeMap: refactoring around edges, missed spots)
 - #77512 (Allow `Abort` terminators in all const-contexts)
 - #77514 (Replace some once(x).chain(once(y)) with [x, y] IntoIter)

Failed merges:

r? `@ghost`
Diffstat (limited to 'src/test/ui/const-generics/generic-function-call-in-array-length.rs')
-rw-r--r--src/test/ui/const-generics/generic-function-call-in-array-length.rs16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/test/ui/const-generics/generic-function-call-in-array-length.rs b/src/test/ui/const-generics/generic-function-call-in-array-length.rs
new file mode 100644
index 00000000000..c8bbae29343
--- /dev/null
+++ b/src/test/ui/const-generics/generic-function-call-in-array-length.rs
@@ -0,0 +1,16 @@
+// revisions: full min
+
+#![cfg_attr(full, allow(incomplete_features))]
+#![cfg_attr(full, feature(const_generics))]
+#![cfg_attr(min, feature(min_const_generics))]
+
+const fn foo(n: usize) -> usize { n * 2 }
+
+fn bar<const N: usize>() -> [u32; foo(N)] {
+    //[min]~^ ERROR generic parameters must not be used inside of non-trivial constant values
+    //[full]~^^ ERROR constant expression depends on a generic parameter
+    [0; foo(N)]
+    //[min]~^ ERROR generic parameters must not be used inside of non-trivial constant values
+}
+
+fn main() {}