Add a test for a function taking a const param array as an argument
This commit is contained in:
parent
73f7e426be
commit
5a585fe45e
2 changed files with 22 additions and 0 deletions
16
src/test/ui/const-generics/fn-taking-const-generic-array.rs
Normal file
16
src/test/ui/const-generics/fn-taking-const-generic-array.rs
Normal 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]);
|
||||
}
|
|
@ -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)]
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue