From a3df1db8ee40f8c5dc520a5d0a37adc5a70a15be Mon Sep 17 00:00:00 2001 From: Bastian Kauschke Date: Mon, 30 Mar 2020 19:34:16 +0200 Subject: update tests, improve variable names --- src/test/ui/array-slice-vec/match_arr_unknown_len.rs | 11 +++++++++++ .../ui/array-slice-vec/match_arr_unknown_len.stderr | 20 ++++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 src/test/ui/array-slice-vec/match_arr_unknown_len.rs create mode 100644 src/test/ui/array-slice-vec/match_arr_unknown_len.stderr (limited to 'src/test/ui/array-slice-vec') diff --git a/src/test/ui/array-slice-vec/match_arr_unknown_len.rs b/src/test/ui/array-slice-vec/match_arr_unknown_len.rs new file mode 100644 index 00000000000..7f3da75ddcb --- /dev/null +++ b/src/test/ui/array-slice-vec/match_arr_unknown_len.rs @@ -0,0 +1,11 @@ +#![feature(const_generics)] +//~^ WARN the feature `const_generics` is incomplete and may cause the compiler to crash + +fn is_123(x: [u32; N]) -> bool { + match x { + [1, 2] => true, //~ ERROR mismatched types + _ => false + } +} + +fn main() {} diff --git a/src/test/ui/array-slice-vec/match_arr_unknown_len.stderr b/src/test/ui/array-slice-vec/match_arr_unknown_len.stderr new file mode 100644 index 00000000000..9edb139028b --- /dev/null +++ b/src/test/ui/array-slice-vec/match_arr_unknown_len.stderr @@ -0,0 +1,20 @@ +warning: the feature `const_generics` is incomplete and may cause the compiler to crash + --> $DIR/match_arr_unknown_len.rs:1:12 + | +LL | #![feature(const_generics)] + | ^^^^^^^^^^^^^^ + | + = note: `#[warn(incomplete_features)]` on by default + +error[E0308]: mismatched types + --> $DIR/match_arr_unknown_len.rs:6:9 + | +LL | [1, 2] => true, + | ^^^^^^ expected `2usize`, found `N` + | + = note: expected array `[u32; 2]` + found array `[u32; _]` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. -- cgit 1.4.1-3-g733a5