From ffa7ce42901b7206f06de735986a6e009e6c1c5b Mon Sep 17 00:00:00 2001 From: Oliver Scherer Date: Thu, 8 Nov 2018 20:18:26 +0100 Subject: [PATCH] Add more regression tests --- src/test/ui/consts/const-prop-ice2.rs | 5 +++++ src/test/ui/consts/const-prop-ice2.stderr | 10 ++++++++++ 2 files changed, 15 insertions(+) create mode 100644 src/test/ui/consts/const-prop-ice2.rs create mode 100644 src/test/ui/consts/const-prop-ice2.stderr diff --git a/src/test/ui/consts/const-prop-ice2.rs b/src/test/ui/consts/const-prop-ice2.rs new file mode 100644 index 00000000000..23bdda2cba7 --- /dev/null +++ b/src/test/ui/consts/const-prop-ice2.rs @@ -0,0 +1,5 @@ +fn main() { + enum Enum { One=1 } + let xs=[0;1 as usize]; + println!("{}", xs[Enum::One as usize]); //~ ERROR the len is 1 but the index is 1 +} \ No newline at end of file diff --git a/src/test/ui/consts/const-prop-ice2.stderr b/src/test/ui/consts/const-prop-ice2.stderr new file mode 100644 index 00000000000..4febd0ee1e3 --- /dev/null +++ b/src/test/ui/consts/const-prop-ice2.stderr @@ -0,0 +1,10 @@ +error: index out of bounds: the len is 1 but the index is 1 + --> $DIR/const-prop-ice2.rs:4:20 + | +LL | println!("{}", xs[Enum::One as usize]); //~ ERROR the len is 1 but the index is 1 + | ^^^^^^^^^^^^^^^^^^^^^^ + | + = note: #[deny(const_err)] on by default + +error: aborting due to previous error +