1
Fork 0

Add a test for a function taking a const param array as an argument

This commit is contained in:
varkor 2019-05-11 18:02:05 +01:00
parent 73f7e426be
commit 5a585fe45e
2 changed files with 22 additions and 0 deletions

View file

@ -0,0 +1,16 @@
// run-pass
#![feature(const_generics)]
//~^ WARN the feature `const_generics` is incomplete and may cause the compiler to crash
use std::fmt::Display;
fn print_slice<T: Display, const N: usize>(slice: &[T; N]) {
for x in slice.iter() {
println!("{}", x);
}
}
fn main() {
print_slice(&[1, 2, 3]);
}

View file

@ -0,0 +1,6 @@
warning: the feature `const_generics` is incomplete and may cause the compiler to crash
--> $DIR/fn-taking-const-generic-array.rs:3:12
|
LL | #![feature(const_generics)]
| ^^^^^^^^^^^^^^