Rollup merge of #74671 - rust-lang:const-generics-coerce-unsized, r=nikomatsakis
add const generics array coercion test
This commit is contained in:
commit
157975c6c4
11
src/test/ui/const-generics/coerce_unsized_array.rs
Normal file
11
src/test/ui/const-generics/coerce_unsized_array.rs
Normal 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]);
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user