about summary refs log tree commit diff
diff options
context:
space:
mode:
authorYuki Okushi <huyuumi.dev@gmail.com>2020-07-29 09:24:15 +0900
committerGitHub <noreply@github.com>2020-07-29 09:24:15 +0900
commit157975c6c40b02e56e931617f1d6c8148bc7d2bd (patch)
treeb0ef06d3e2cfa212e04045558f707d5fc4f64165
parent1ed74eeef9a00283773d86fc72367ff78d9a259d (diff)
parent49b1971263971db49e821f81bb54991b7de5ab43 (diff)
downloadrust-157975c6c40b02e56e931617f1d6c8148bc7d2bd.tar.gz
rust-157975c6c40b02e56e931617f1d6c8148bc7d2bd.zip
Rollup merge of #74671 - rust-lang:const-generics-coerce-unsized, r=nikomatsakis
add const generics array coercion test
-rw-r--r--src/test/ui/const-generics/coerce_unsized_array.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/test/ui/const-generics/coerce_unsized_array.rs b/src/test/ui/const-generics/coerce_unsized_array.rs
new file mode 100644
index 00000000000..b28768a5163
--- /dev/null
+++ b/src/test/ui/const-generics/coerce_unsized_array.rs
@@ -0,0 +1,11 @@
+// run-pass
+#![feature(const_generics)]
+#![allow(incomplete_features)]
+
+fn foo<const N: usize>(v: &[u8; N]) -> &[u8] {
+    v
+}
+
+fn main() {
+    assert_eq!(foo(&[1, 2]), &[1, 2]);
+}