mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-08 01:28:18 +03:00
Add a test for a function taking a const param array as an argument
This commit is contained in:
@@ -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)]
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
||||
Reference in New Issue
Block a user