From 5a585fe45e93b946013ec2eebb0b2c2ec3bed15a Mon Sep 17 00:00:00 2001 From: varkor Date: Sat, 11 May 2019 18:02:05 +0100 Subject: [PATCH] Add a test for a function taking a const param array as an argument --- .../fn-taking-const-generic-array.rs | 16 ++++++++++++++++ .../fn-taking-const-generic-array.stderr | 6 ++++++ 2 files changed, 22 insertions(+) create mode 100644 src/test/ui/const-generics/fn-taking-const-generic-array.rs create mode 100644 src/test/ui/const-generics/fn-taking-const-generic-array.stderr 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(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)] + | ^^^^^^^^^^^^^^ +