Rollup merge of #74671 - rust-lang:const-generics-coerce-unsized, r=nikomatsakis

add const generics array coercion test
This commit is contained in:
Yuki Okushi 2020-07-29 09:24:15 +09:00 committed by GitHub
commit 157975c6c4
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]);
}