diff options
| author | varkor <github@varkor.com> | 2019-05-11 18:02:05 +0100 |
|---|---|---|
| committer | varkor <github@varkor.com> | 2019-05-28 21:34:42 +0100 |
| commit | 5a585fe45e93b946013ec2eebb0b2c2ec3bed15a (patch) | |
| tree | 73ce05c363157ffe269015a9646aba84d7fde0e3 | |
| parent | 73f7e426be348e9d479c8685843399b9cbbff064 (diff) | |
| download | rust-5a585fe45e93b946013ec2eebb0b2c2ec3bed15a.tar.gz rust-5a585fe45e93b946013ec2eebb0b2c2ec3bed15a.zip | |
Add a test for a function taking a const param array as an argument
| -rw-r--r-- | src/test/ui/const-generics/fn-taking-const-generic-array.rs | 16 | ||||
| -rw-r--r-- | src/test/ui/const-generics/fn-taking-const-generic-array.stderr | 6 |
2 files changed, 22 insertions, 0 deletions
diff --git a/src/test/ui/const-generics/fn-taking-const-generic-array.rs b/src/test/ui/const-generics/fn-taking-const-generic-array.rs new file mode 100644 index 00000000000..d3d17cca4da --- /dev/null +++ b/src/test/ui/const-generics/fn-taking-const-generic-array.rs @@ -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]); +} diff --git a/src/test/ui/const-generics/fn-taking-const-generic-array.stderr b/src/test/ui/const-generics/fn-taking-const-generic-array.stderr new file mode 100644 index 00000000000..36704128325 --- /dev/null +++ b/src/test/ui/const-generics/fn-taking-const-generic-array.stderr @@ -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)] + | ^^^^^^^^^^^^^^ + |
