about summary refs log tree commit diff
diff options
context:
space:
mode:
authorOliver Scherer <github35764891676564198441@oli-obk.de>2019-12-09 13:05:41 +0100
committerMark Rousskov <mark.simulacrum@gmail.com>2019-12-14 10:51:51 -0500
commitf4ff238a2e45e6412b9bf164e801a2e4809bdd3b (patch)
tree04007489db0ef461441ca6dbeaf77ff016d5ece2
parent04a46929f2c53fb9e20c182f8be02566eb31c65f (diff)
downloadrust-f4ff238a2e45e6412b9bf164e801a2e4809bdd3b.tar.gz
rust-f4ff238a2e45e6412b9bf164e801a2e4809bdd3b.zip
Show const_err lint in addition to the hard error
-rw-r--r--src/test/ui/consts/assoc_const_generic_impl.rs4
-rw-r--r--src/test/ui/consts/assoc_const_generic_impl.stderr14
2 files changed, 16 insertions, 2 deletions
diff --git a/src/test/ui/consts/assoc_const_generic_impl.rs b/src/test/ui/consts/assoc_const_generic_impl.rs
index cce0cdbf8c5..62702a8ec5c 100644
--- a/src/test/ui/consts/assoc_const_generic_impl.rs
+++ b/src/test/ui/consts/assoc_const_generic_impl.rs
@@ -1,4 +1,4 @@
-#![allow(const_err)]
+#![warn(const_err)]
 
 trait ZeroSized: Sized {
     const I_AM_ZERO_SIZED: ();
@@ -6,7 +6,7 @@ trait ZeroSized: Sized {
 }
 
 impl<T: Sized> ZeroSized for T {
-    const I_AM_ZERO_SIZED: ()  = [()][std::mem::size_of::<Self>()];
+    const I_AM_ZERO_SIZED: ()  = [()][std::mem::size_of::<Self>()]; //~ WARN any use of this value
     fn requires_zero_size(self) {
         let () = Self::I_AM_ZERO_SIZED; //~ ERROR erroneous constant encountered
         println!("requires_zero_size called");
diff --git a/src/test/ui/consts/assoc_const_generic_impl.stderr b/src/test/ui/consts/assoc_const_generic_impl.stderr
index 3765a3703c7..a114d5c6ccd 100644
--- a/src/test/ui/consts/assoc_const_generic_impl.stderr
+++ b/src/test/ui/consts/assoc_const_generic_impl.stderr
@@ -1,3 +1,17 @@
+warning: any use of this value will cause an error
+  --> $DIR/assoc_const_generic_impl.rs:9:34
+   |
+LL |     const I_AM_ZERO_SIZED: ()  = [()][std::mem::size_of::<Self>()];
+   |     -----------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
+   |                                  |
+   |                                  index out of bounds: the len is 1 but the index is 4
+   |
+note: lint level defined here
+  --> $DIR/assoc_const_generic_impl.rs:1:9
+   |
+LL | #![warn(const_err)]
+   |         ^^^^^^^^^
+
 error: erroneous constant encountered
   --> $DIR/assoc_const_generic_impl.rs:11:18
    |