diff options
| author | varkor <github@varkor.com> | 2019-05-31 22:27:26 +0100 |
|---|---|---|
| committer | varkor <github@varkor.com> | 2019-06-02 01:55:46 +0100 |
| commit | 5a2410a07c8b151cd518792f41fce3341af004cf (patch) | |
| tree | 4d124b6e225617e0c0c95e4d4509ca82f7164711 /src/test/ui/error-codes | |
| parent | 21551359a5e5272b5a71a69a9115fdd83379fcb7 (diff) | |
| download | rust-5a2410a07c8b151cd518792f41fce3341af004cf.tar.gz rust-5a2410a07c8b151cd518792f41fce3341af004cf.zip | |
Add error for pattern-matching on arrays without a fixed size
Diffstat (limited to 'src/test/ui/error-codes')
| -rw-r--r-- | src/test/ui/error-codes/E0730.rs | 11 | ||||
| -rw-r--r-- | src/test/ui/error-codes/E0730.stderr | 15 |
2 files changed, 26 insertions, 0 deletions
diff --git a/src/test/ui/error-codes/E0730.rs b/src/test/ui/error-codes/E0730.rs new file mode 100644 index 00000000000..e5048d6e6e3 --- /dev/null +++ b/src/test/ui/error-codes/E0730.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<const N: usize>(x: [u32; N]) -> bool { + match x { + [1, 2, 3] => true, //~ ERROR cannot pattern-match on an array without a fixed length + _ => false + } +} + +fn main() {} diff --git a/src/test/ui/error-codes/E0730.stderr b/src/test/ui/error-codes/E0730.stderr new file mode 100644 index 00000000000..f9281262bb7 --- /dev/null +++ b/src/test/ui/error-codes/E0730.stderr @@ -0,0 +1,15 @@ +warning: the feature `const_generics` is incomplete and may cause the compiler to crash + --> $DIR/E0730.rs:1:12 + | +LL | #![feature(const_generics)] + | ^^^^^^^^^^^^^^ + +error[E0730]: cannot pattern-match on an array without a fixed length + --> $DIR/E0730.rs:6:9 + | +LL | [1, 2, 3] => true, + | ^^^^^^^^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0730`. |
