add const generics

This commit is contained in:
Bastian Kauschke 2020-07-23 10:55:20 +02:00 committed by GitHub
parent e8b55a4ad2
commit 49b1971263
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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]);
}