about summary refs log tree commit diff
diff options
context:
space:
mode:
authorBastian Kauschke <bastian_kauschke@hotmail.de>2020-07-23 10:55:20 +0200
committerGitHub <noreply@github.com>2020-07-23 10:55:20 +0200
commit49b1971263971db49e821f81bb54991b7de5ab43 (patch)
treeb4fc691226b6b6b3c470e1940444e18347632111
parente8b55a4ad230ebec762fdfc4f241ba98a98560af (diff)
downloadrust-49b1971263971db49e821f81bb54991b7de5ab43.tar.gz
rust-49b1971263971db49e821f81bb54991b7de5ab43.zip
add const generics
-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]);
+}