about summary refs log tree commit diff
diff options
context:
space:
mode:
authorOli Scherer <github333195615777966@oli-obk.de>2025-05-28 10:29:08 +0000
committerOli Scherer <github333195615777966@oli-obk.de>2025-06-02 15:37:15 +0000
commit166f664495bf76e932b115f6a92a89bd2a067b54 (patch)
treedd5c52c122cb732a7b34873bda6fcf9881c99e8e
parent660aede53066ca0ab4354160d982d19b7962739b (diff)
downloadrust-166f664495bf76e932b115f6a92a89bd2a067b54.tar.gz
rust-166f664495bf76e932b115f6a92a89bd2a067b54.zip
Use the informative error as the main const eval error message
-rw-r--r--tests/ui/indexing_slicing_index.rs2
-rw-r--r--tests/ui/indexing_slicing_index.stderr4
2 files changed, 3 insertions, 3 deletions
diff --git a/tests/ui/indexing_slicing_index.rs b/tests/ui/indexing_slicing_index.rs
index cfa1c2f7c75..ab6a8235008 100644
--- a/tests/ui/indexing_slicing_index.rs
+++ b/tests/ui/indexing_slicing_index.rs
@@ -68,7 +68,7 @@ fn main() {
     // This should be linted, since `suppress-restriction-lint-in-const` default is false.
     const { &ARR[idx4()] };
     //~^ ERROR: indexing may panic
-    //~| ERROR: evaluation of `main
+    //~| ERROR: index out of bounds
 
     let y = &x;
     // Ok, referencing shouldn't affect this lint. See the issue 6021
diff --git a/tests/ui/indexing_slicing_index.stderr b/tests/ui/indexing_slicing_index.stderr
index 50ee9b9edc7..453da135fff 100644
--- a/tests/ui/indexing_slicing_index.stderr
+++ b/tests/ui/indexing_slicing_index.stderr
@@ -9,11 +9,11 @@ LL | const REF: &i32 = &ARR[idx()]; // This should be linted, since `suppress-re
    = note: `-D clippy::indexing-slicing` implied by `-D warnings`
    = help: to override `-D warnings` add `#[allow(clippy::indexing_slicing)]`
 
-error[E0080]: evaluation of `main::{constant#3}` failed
+error[E0080]: index out of bounds: the length is 2 but the index is 4
   --> tests/ui/indexing_slicing_index.rs:69:14
    |
 LL |     const { &ARR[idx4()] };
-   |              ^^^^^^^^^^^ index out of bounds: the length is 2 but the index is 4
+   |              ^^^^^^^^^^^ evaluation of `main::{constant#3}` failed
 
 note: erroneous constant encountered
   --> tests/ui/indexing_slicing_index.rs:69:5