@@ -9,37 +9,28 @@ 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: indexing may panic
13-   --> $DIR/indexing_slicing_index.rs:16:24
14-    |
15- LL | const REF_ERR: &i32 = &ARR[idx4()]; // Ok, let rustc handle const contexts.
16-    |                        ^^^^^^^^^^^
17-    |
18-    = help: consider using `.get(n)` or `.get_mut(n)` instead
19-    = note: the suggestion might not be applicable in constant blocks
20- 
2112error[E0080]: evaluation of `main::{constant#3}` failed
22-   --> $DIR/indexing_slicing_index.rs:48 :14
13+   --> $DIR/indexing_slicing_index.rs:46 :14
2314   |
2415LL |     const { &ARR[idx4()] };
2516   |              ^^^^^^^^^^^ index out of bounds: the length is 2 but the index is 4
2617
2718note: erroneous constant encountered
28-   --> $DIR/indexing_slicing_index.rs:48 :5
19+   --> $DIR/indexing_slicing_index.rs:46 :5
2920   |
3021LL |     const { &ARR[idx4()] };
3122   |     ^^^^^^^^^^^^^^^^^^^^^^
3223
3324error: indexing may panic
34-   --> $DIR/indexing_slicing_index.rs:29 :5
25+   --> $DIR/indexing_slicing_index.rs:27 :5
3526   |
3627LL |     x[index];
3728   |     ^^^^^^^^
3829   |
3930   = help: consider using `.get(n)` or `.get_mut(n)` instead
4031
4132error: index is out of bounds
42-   --> $DIR/indexing_slicing_index.rs:32 :5
33+   --> $DIR/indexing_slicing_index.rs:30 :5
4334   |
4435LL |     x[4];
4536   |     ^^^^
@@ -48,13 +39,13 @@ LL |     x[4];
4839   = help: to override `-D warnings` add `#[allow(clippy::out_of_bounds_indexing)]`
4940
5041error: index is out of bounds
51-   --> $DIR/indexing_slicing_index.rs:34 :5
42+   --> $DIR/indexing_slicing_index.rs:32 :5
5243   |
5344LL |     x[1 << 3];
5445   |     ^^^^^^^^^
5546
5647error: indexing may panic
57-   --> $DIR/indexing_slicing_index.rs:45 :14
48+   --> $DIR/indexing_slicing_index.rs:43 :14
5849   |
5950LL |     const { &ARR[idx()] };
6051   |              ^^^^^^^^^^
@@ -63,7 +54,7 @@ LL |     const { &ARR[idx()] };
6354   = note: the suggestion might not be applicable in constant blocks
6455
6556error: indexing may panic
66-   --> $DIR/indexing_slicing_index.rs:48 :14
57+   --> $DIR/indexing_slicing_index.rs:46 :14
6758   |
6859LL |     const { &ARR[idx4()] };
6960   |              ^^^^^^^^^^^
@@ -72,69 +63,63 @@ LL |     const { &ARR[idx4()] };
7263   = note: the suggestion might not be applicable in constant blocks
7364
7465error: index is out of bounds
75-   --> $DIR/indexing_slicing_index.rs:55 :5
66+   --> $DIR/indexing_slicing_index.rs:53 :5
7667   |
7768LL |     y[4];
7869   |     ^^^^
7970
8071error: indexing may panic
81-   --> $DIR/indexing_slicing_index.rs:58 :5
72+   --> $DIR/indexing_slicing_index.rs:56 :5
8273   |
8374LL |     v[0];
8475   |     ^^^^
8576   |
8677   = help: consider using `.get(n)` or `.get_mut(n)` instead
8778
8879error: indexing may panic
89-   --> $DIR/indexing_slicing_index.rs:60 :5
80+   --> $DIR/indexing_slicing_index.rs:58 :5
9081   |
9182LL |     v[10];
9283   |     ^^^^^
9384   |
9485   = help: consider using `.get(n)` or `.get_mut(n)` instead
9586
9687error: indexing may panic
97-   --> $DIR/indexing_slicing_index.rs:62 :5
88+   --> $DIR/indexing_slicing_index.rs:60 :5
9889   |
9990LL |     v[1 << 3];
10091   |     ^^^^^^^^^
10192   |
10293   = help: consider using `.get(n)` or `.get_mut(n)` instead
10394
10495error: index is out of bounds
105-   --> $DIR/indexing_slicing_index.rs:70 :5
96+   --> $DIR/indexing_slicing_index.rs:68 :5
10697   |
10798LL |     x[N];
10899   |     ^^^^
109100
110101error: indexing may panic
111-   --> $DIR/indexing_slicing_index.rs:73 :5
102+   --> $DIR/indexing_slicing_index.rs:71 :5
112103   |
113104LL |     v[N];
114105   |     ^^^^
115106   |
116107   = help: consider using `.get(n)` or `.get_mut(n)` instead
117108
118109error: indexing may panic
119-   --> $DIR/indexing_slicing_index.rs:75 :5
110+   --> $DIR/indexing_slicing_index.rs:73 :5
120111   |
121112LL |     v[M];
122113   |     ^^^^
123114   |
124115   = help: consider using `.get(n)` or `.get_mut(n)` instead
125116
126117error: index is out of bounds
127-   --> $DIR/indexing_slicing_index.rs:79 :13
118+   --> $DIR/indexing_slicing_index.rs:77 :13
128119   |
129120LL |     let _ = x[4];
130121   |             ^^^^
131122
132- error[E0080]: evaluation of constant value failed
133-   --> $DIR/indexing_slicing_index.rs:16:24
134-    |
135- LL | const REF_ERR: &i32 = &ARR[idx4()]; // Ok, let rustc handle const contexts.
136-    |                        ^^^^^^^^^^^ index out of bounds: the length is 2 but the index is 4
137- 
138- error: aborting due to 17 previous errors
123+ error: aborting due to 15 previous errors
139124
140125For more information about this error, try `rustc --explain E0080`.
0 commit comments