Skip to content

Commit a0b0f91

Browse files
authored
Rollup merge of rust-lang#141698 - oli-obk:ctfe-err-flip, r=RalfJung
Use the informative error as the main const eval error message r? `@RalfJung` I only did the minimal changes necessary to the const eval error machinery. I'd prefer not to mix test changes with refactorings 😆
2 parents 4effc58 + d1f9d02 commit a0b0f91

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

tests/ui/indexing_slicing_index.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ fn main() {
6868
// This should be linted, since `suppress-restriction-lint-in-const` default is false.
6969
const { &ARR[idx4()] };
7070
//~^ ERROR: indexing may panic
71-
//~| ERROR: evaluation of `main
71+
//~| ERROR: index out of bounds
7272

7373
let y = &x;
7474
// Ok, referencing shouldn't affect this lint. See the issue 6021

tests/ui/indexing_slicing_index.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ LL | const REF: &i32 = &ARR[idx()]; // This should be linted, since `suppress-re
99
= note: `-D clippy::indexing-slicing` implied by `-D warnings`
1010
= help: to override `-D warnings` add `#[allow(clippy::indexing_slicing)]`
1111

12-
error[E0080]: evaluation of `main::{constant#3}` failed
12+
error[E0080]: index out of bounds: the length is 2 but the index is 4
1313
--> tests/ui/indexing_slicing_index.rs:69:14
1414
|
1515
LL | const { &ARR[idx4()] };
16-
| ^^^^^^^^^^^ index out of bounds: the length is 2 but the index is 4
16+
| ^^^^^^^^^^^ evaluation of `main::{constant#3}` failed here
1717

1818
note: erroneous constant encountered
1919
--> tests/ui/indexing_slicing_index.rs:69:5

0 commit comments

Comments
 (0)