about summary refs log tree commit diff
path: root/src/tools
diff options
context:
space:
mode:
authorRalf Jung <post@ralfj.de>2022-09-21 13:05:20 +0200
committerRalf Jung <post@ralfj.de>2022-10-07 18:08:49 +0200
commitfd59d44f5880fea109fe68e31fab2486cd686fc6 (patch)
tree3eef90caf77fefc09fc993e511f9a9b8f5470cb2 /src/tools
parent58546803885164d488185fb9cb9fb04fcbe64e30 (diff)
downloadrust-fd59d44f5880fea109fe68e31fab2486cd686fc6.tar.gz
rust-fd59d44f5880fea109fe68e31fab2486cd686fc6.zip
make const_err a hard error
Diffstat (limited to 'src/tools')
-rw-r--r--src/tools/clippy/clippy_lints/src/indexing_slicing.rs1
-rw-r--r--src/tools/clippy/tests/ui/crashes/ice-9463.rs2
-rw-r--r--src/tools/clippy/tests/ui/crashes/ice-9463.stderr2
-rw-r--r--src/tools/clippy/tests/ui/indexing_slicing_index.rs2
-rw-r--r--src/tools/clippy/tests/ui/indexing_slicing_index.stderr8
-rw-r--r--src/tools/clippy/tests/ui/out_of_bounds_indexing/issue-3102.rs2
-rw-r--r--src/tools/clippy/tests/ui/out_of_bounds_indexing/simple.rs2
-rw-r--r--src/tools/miri/tests/fail/erroneous_const.rs1
-rw-r--r--src/tools/miri/tests/fail/erroneous_const2.rs8
-rw-r--r--src/tools/miri/tests/fail/erroneous_const2.stderr36
10 files changed, 17 insertions, 47 deletions
diff --git a/src/tools/clippy/clippy_lints/src/indexing_slicing.rs b/src/tools/clippy/clippy_lints/src/indexing_slicing.rs
index 4a375752e1d..af40a5a8187 100644
--- a/src/tools/clippy/clippy_lints/src/indexing_slicing.rs
+++ b/src/tools/clippy/clippy_lints/src/indexing_slicing.rs
@@ -19,7 +19,6 @@ declare_clippy_lint! {
     ///
     /// ### Example
     /// ```rust,no_run
-    /// # #![allow(const_err)]
     /// let x = [1, 2, 3, 4];
     ///
     /// x[9];
diff --git a/src/tools/clippy/tests/ui/crashes/ice-9463.rs b/src/tools/clippy/tests/ui/crashes/ice-9463.rs
index 41ef930d323..9564e77c24b 100644
--- a/src/tools/clippy/tests/ui/crashes/ice-9463.rs
+++ b/src/tools/clippy/tests/ui/crashes/ice-9463.rs
@@ -1,4 +1,4 @@
-#![deny(arithmetic_overflow, const_err)]
+#![deny(arithmetic_overflow)]
 fn main() {
     let _x = -1_i32 >> -1;
     let _y = 1u32 >> 10000000000000u32;
diff --git a/src/tools/clippy/tests/ui/crashes/ice-9463.stderr b/src/tools/clippy/tests/ui/crashes/ice-9463.stderr
index b0ce306d683..2b425e85a27 100644
--- a/src/tools/clippy/tests/ui/crashes/ice-9463.stderr
+++ b/src/tools/clippy/tests/ui/crashes/ice-9463.stderr
@@ -7,7 +7,7 @@ LL |     let _x = -1_i32 >> -1;
 note: the lint level is defined here
   --> $DIR/ice-9463.rs:1:9
    |
-LL | #![deny(arithmetic_overflow, const_err)]
+LL | #![deny(arithmetic_overflow)]
    |         ^^^^^^^^^^^^^^^^^^^
 
 error: this arithmetic operation will overflow
diff --git a/src/tools/clippy/tests/ui/indexing_slicing_index.rs b/src/tools/clippy/tests/ui/indexing_slicing_index.rs
index 7ebf6ee993c..4476e0eb922 100644
--- a/src/tools/clippy/tests/ui/indexing_slicing_index.rs
+++ b/src/tools/clippy/tests/ui/indexing_slicing_index.rs
@@ -3,7 +3,7 @@
 // We also check the out_of_bounds_indexing lint here, because it lints similar things and
 // we want to avoid false positives.
 #![warn(clippy::out_of_bounds_indexing)]
-#![allow(const_err, unconditional_panic, clippy::no_effect, clippy::unnecessary_operation)]
+#![allow(unconditional_panic, clippy::no_effect, clippy::unnecessary_operation)]
 
 const ARR: [i32; 2] = [1, 2];
 const REF: &i32 = &ARR[idx()]; // Ok, should not produce stderr.
diff --git a/src/tools/clippy/tests/ui/indexing_slicing_index.stderr b/src/tools/clippy/tests/ui/indexing_slicing_index.stderr
index a8d8b38163d..da5bc38b3b6 100644
--- a/src/tools/clippy/tests/ui/indexing_slicing_index.stderr
+++ b/src/tools/clippy/tests/ui/indexing_slicing_index.stderr
@@ -59,6 +59,12 @@ LL |     v[M];
    |
    = help: consider using `.get(n)` or `.get_mut(n)` instead
 
-error: aborting due to 8 previous errors
+error[E0080]: evaluation of constant value failed
+  --> $DIR/indexing_slicing_index.rs:10:24
+   |
+LL | const REF_ERR: &i32 = &ARR[idx4()]; // Ok, let rustc handle const contexts.
+   |                        ^^^^^^^^^^^ index out of bounds: the length is 2 but the index is 4
+
+error: aborting due to 9 previous errors
 
 For more information about this error, try `rustc --explain E0080`.
diff --git a/src/tools/clippy/tests/ui/out_of_bounds_indexing/issue-3102.rs b/src/tools/clippy/tests/ui/out_of_bounds_indexing/issue-3102.rs
index f20a0ede113..edd2123d48a 100644
--- a/src/tools/clippy/tests/ui/out_of_bounds_indexing/issue-3102.rs
+++ b/src/tools/clippy/tests/ui/out_of_bounds_indexing/issue-3102.rs
@@ -1,5 +1,5 @@
 #![warn(clippy::out_of_bounds_indexing)]
-#![allow(clippy::no_effect, const_err)]
+#![allow(clippy::no_effect)]
 
 fn main() {
     let x = [1, 2, 3, 4];
diff --git a/src/tools/clippy/tests/ui/out_of_bounds_indexing/simple.rs b/src/tools/clippy/tests/ui/out_of_bounds_indexing/simple.rs
index 590e578d758..4c541c23f5f 100644
--- a/src/tools/clippy/tests/ui/out_of_bounds_indexing/simple.rs
+++ b/src/tools/clippy/tests/ui/out_of_bounds_indexing/simple.rs
@@ -1,5 +1,5 @@
 #![warn(clippy::out_of_bounds_indexing)]
-#![allow(clippy::no_effect, clippy::unnecessary_operation, const_err)]
+#![allow(clippy::no_effect, clippy::unnecessary_operation)]
 
 fn main() {
     let x = [1, 2, 3, 4];
diff --git a/src/tools/miri/tests/fail/erroneous_const.rs b/src/tools/miri/tests/fail/erroneous_const.rs
index c35a9050359..d14998ccba2 100644
--- a/src/tools/miri/tests/fail/erroneous_const.rs
+++ b/src/tools/miri/tests/fail/erroneous_const.rs
@@ -3,7 +3,6 @@
 // Inlining changes the error location
 //@compile-flags: -Zmir-opt-level=0
 #![feature(never_type)]
-#![warn(warnings, const_err)]
 
 struct PrintName<T>(T);
 impl<T> PrintName<T> {
diff --git a/src/tools/miri/tests/fail/erroneous_const2.rs b/src/tools/miri/tests/fail/erroneous_const2.rs
index 6628166cfac..9a1a970778f 100644
--- a/src/tools/miri/tests/fail/erroneous_const2.rs
+++ b/src/tools/miri/tests/fail/erroneous_const2.rs
@@ -1,13 +1,9 @@
 const X: u32 = 5;
 const Y: u32 = 6;
 const FOO: u32 = [X - Y, Y - X][(X < Y) as usize];
-//~^ERROR: any use of this value
-//~|WARN: previously accepted
+//~^ERROR: evaluation of constant value failed
 
 #[rustfmt::skip] // rustfmt bug: https://github.com/rust-lang/rustfmt/issues/5391
 fn main() {
-    println!("{}", FOO); //~ERROR: post-monomorphization error
-    //~|ERROR: evaluation of constant value failed
-    //~|ERROR: erroneous constant used
-    //~|WARN: previously accepted
+    println!("{}", FOO);
 }
diff --git a/src/tools/miri/tests/fail/erroneous_const2.stderr b/src/tools/miri/tests/fail/erroneous_const2.stderr
index 4d402257b8b..d41fcfd2302 100644
--- a/src/tools/miri/tests/fail/erroneous_const2.stderr
+++ b/src/tools/miri/tests/fail/erroneous_const2.stderr
@@ -1,39 +1,9 @@
-error: any use of this value will cause an error
-  --> $DIR/erroneous_const2.rs:LL:CC
-   |
-LL | const FOO: u32 = [X - Y, Y - X][(X < Y) as usize];
-   | --------------    ^^^^^ attempt to compute `5_u32 - 6_u32`, which would overflow
-   |
-   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
-   = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
-   = note: `#[deny(const_err)]` on by default
-
 error[E0080]: evaluation of constant value failed
   --> $DIR/erroneous_const2.rs:LL:CC
    |
-LL |     println!("{}", FOO);
-   |                    ^^^ referenced constant has errors
-
-error: erroneous constant used
-  --> $DIR/erroneous_const2.rs:LL:CC
-   |
-LL |     println!("{}", FOO);
-   |                    ^^^ referenced constant has errors
-   |
-   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
-   = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
-   = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)
-
-error: post-monomorphization error: referenced constant has errors
-  --> $DIR/erroneous_const2.rs:LL:CC
-   |
-LL |     println!("{}", FOO);
-   |                    ^^^ referenced constant has errors
-   |
-   = note: inside `main` at $DIR/erroneous_const2.rs:LL:CC
-
-note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace
+LL | const FOO: u32 = [X - Y, Y - X][(X < Y) as usize];
+   |                   ^^^^^ attempt to compute `5_u32 - 6_u32`, which would overflow
 
-error: aborting due to 4 previous errors
+error: aborting due to previous error
 
 For more information about this error, try `rustc --explain E0080`.