]> git.lizzy.rs Git - rust.git/commitdiff
Add more regression tests
authorOliver Scherer <github35764891676564198441@oli-obk.de>
Thu, 8 Nov 2018 19:18:26 +0000 (20:18 +0100)
committerOliver Scherer <github35764891676564198441@oli-obk.de>
Thu, 8 Nov 2018 19:18:26 +0000 (20:18 +0100)
src/test/ui/consts/const-prop-ice2.rs [new file with mode: 0644]
src/test/ui/consts/const-prop-ice2.stderr [new file with mode: 0644]

diff --git a/src/test/ui/consts/const-prop-ice2.rs b/src/test/ui/consts/const-prop-ice2.rs
new file mode 100644 (file)
index 0000000..23bdda2
--- /dev/null
@@ -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 (file)
index 0000000..4febd0e
--- /dev/null
@@ -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
+