Skip to content

Commit 5a585fe

Browse files
committed
Add a test for a function taking a const param array as an argument
1 parent 73f7e42 commit 5a585fe

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// run-pass
2+
3+
#![feature(const_generics)]
4+
//~^ WARN the feature `const_generics` is incomplete and may cause the compiler to crash
5+
6+
use std::fmt::Display;
7+
8+
fn print_slice<T: Display, const N: usize>(slice: &[T; N]) {
9+
for x in slice.iter() {
10+
println!("{}", x);
11+
}
12+
}
13+
14+
fn main() {
15+
print_slice(&[1, 2, 3]);
16+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
warning: the feature `const_generics` is incomplete and may cause the compiler to crash
2+
--> $DIR/fn-taking-const-generic-array.rs:3:12
3+
|
4+
LL | #![feature(const_generics)]
5+
| ^^^^^^^^^^^^^^
6+

0 commit comments

Comments
 (0)