1 error: index out of bounds: the len is 4 but the index is 4
2 --> $DIR/indexing_slicing.rs:25:5
4 LL | x[4]; // Ok, let rustc's `const_err` lint handle `usize` indexing on arrays.
7 = note: #[deny(const_err)] on by default
9 error: index out of bounds: the len is 4 but the index is 8
10 --> $DIR/indexing_slicing.rs:26:5
12 LL | x[1 << 3]; // Ok, let rustc's `const_err` lint handle `usize` indexing on arrays.
15 error: index out of bounds: the len is 0 but the index is 0
16 --> $DIR/indexing_slicing.rs:56:5
18 LL | empty[0]; // Ok, let rustc's `const_err` lint handle `usize` indexing on arrays.
21 error: index out of bounds: the len is 4 but the index is 15
22 --> $DIR/indexing_slicing.rs:87:5
24 LL | x[N]; // Ok, let rustc's `const_err` lint handle `usize` indexing on arrays.
27 error: indexing may panic.
28 --> $DIR/indexing_slicing.rs:20:5
33 = note: `-D clippy::indexing-slicing` implied by `-D warnings`
34 = help: Consider using `.get(n)` or `.get_mut(n)` instead
36 error: slicing may panic.
37 --> $DIR/indexing_slicing.rs:21:6
42 = help: Consider using `.get(n..)` or .get_mut(n..)` instead
44 error: slicing may panic.
45 --> $DIR/indexing_slicing.rs:22:6
50 = help: Consider using `.get(..n)`or `.get_mut(..n)` instead
52 error: slicing may panic.
53 --> $DIR/indexing_slicing.rs:23:6
55 LL | &x[index_from..index_to];
56 | ^^^^^^^^^^^^^^^^^^^^^^^
58 = help: Consider using `.get(n..m)` or `.get_mut(n..m)` instead
60 error: slicing may panic.
61 --> $DIR/indexing_slicing.rs:24:6
63 LL | &x[index_from..][..index_to]; // Two lint reports, one for [index_from..] and another for [..index_to].
64 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
66 = help: Consider using `.get(..n)`or `.get_mut(..n)` instead
68 error: slicing may panic.
69 --> $DIR/indexing_slicing.rs:24:6
71 LL | &x[index_from..][..index_to]; // Two lint reports, one for [index_from..] and another for [..index_to].
74 = help: Consider using `.get(n..)` or .get_mut(n..)` instead
76 error: range is out of bounds
77 --> $DIR/indexing_slicing.rs:27:11
82 = note: `-D clippy::out-of-bounds-indexing` implied by `-D warnings`
84 error: range is out of bounds
85 --> $DIR/indexing_slicing.rs:28:11
90 error: slicing may panic.
91 --> $DIR/indexing_slicing.rs:29:6
93 LL | &x[5..][..10]; // Two lint reports, one for [5..] and another for [..10].
96 = help: Consider using `.get(..n)`or `.get_mut(..n)` instead
98 error: range is out of bounds
99 --> $DIR/indexing_slicing.rs:29:8
101 LL | &x[5..][..10]; // Two lint reports, one for [5..] and another for [..10].
104 error: range is out of bounds
105 --> $DIR/indexing_slicing.rs:30:8
110 error: range is out of bounds
111 --> $DIR/indexing_slicing.rs:31:10
116 error: range is out of bounds
117 --> $DIR/indexing_slicing.rs:32:8
119 LL | &x[5..].iter().map(|x| 2 * x).collect::<Vec<i32>>();
122 error: range is out of bounds
123 --> $DIR/indexing_slicing.rs:33:12
128 error: slicing may panic.
129 --> $DIR/indexing_slicing.rs:34:6
134 = help: Consider using `.get(..n)`or `.get_mut(..n)` instead
136 error: slicing may panic.
137 --> $DIR/indexing_slicing.rs:35:6
142 = help: Consider using `.get(..n)`or `.get_mut(..n)` instead
144 error: indexing may panic.
145 --> $DIR/indexing_slicing.rs:48:5
150 = help: Consider using `.get(n)` or `.get_mut(n)` instead
152 error: slicing may panic.
153 --> $DIR/indexing_slicing.rs:49:6
158 = help: Consider using `.get(n..m)` or `.get_mut(n..m)` instead
160 error: slicing may panic.
161 --> $DIR/indexing_slicing.rs:50:6
166 = help: Consider using `.get(n..m)` or `.get_mut(n..m)` instead
168 error: slicing may panic.
169 --> $DIR/indexing_slicing.rs:51:6
174 = help: Consider using `.get(..n)`or `.get_mut(..n)` instead
176 error: range is out of bounds
177 --> $DIR/indexing_slicing.rs:57:12
182 error: range is out of bounds
183 --> $DIR/indexing_slicing.rs:58:16
188 error: range is out of bounds
189 --> $DIR/indexing_slicing.rs:59:15
194 error: range is out of bounds
195 --> $DIR/indexing_slicing.rs:60:12
200 error: range is out of bounds
201 --> $DIR/indexing_slicing.rs:61:14
206 error: range is out of bounds
207 --> $DIR/indexing_slicing.rs:62:16
212 error: range is out of bounds
213 --> $DIR/indexing_slicing.rs:63:15
218 error: indexing may panic.
219 --> $DIR/indexing_slicing.rs:71:5
224 = help: Consider using `.get(n)` or `.get_mut(n)` instead
226 error: indexing may panic.
227 --> $DIR/indexing_slicing.rs:72:5
232 = help: Consider using `.get(n)` or `.get_mut(n)` instead
234 error: indexing may panic.
235 --> $DIR/indexing_slicing.rs:73:5
240 = help: Consider using `.get(n)` or `.get_mut(n)` instead
242 error: slicing may panic.
243 --> $DIR/indexing_slicing.rs:74:6
248 = help: Consider using `.get(n..m)` or `.get_mut(n..m)` instead
250 error: slicing may panic.
251 --> $DIR/indexing_slicing.rs:75:6
253 LL | &x[10..][..100]; // Two lint reports, one for [10..] and another for [..100].
256 = help: Consider using `.get(..n)`or `.get_mut(..n)` instead
258 error: range is out of bounds
259 --> $DIR/indexing_slicing.rs:75:8
261 LL | &x[10..][..100]; // Two lint reports, one for [10..] and another for [..100].
264 error: slicing may panic.
265 --> $DIR/indexing_slicing.rs:76:6
270 = help: Consider using `.get(n..)` or .get_mut(n..)` instead
272 error: slicing may panic.
273 --> $DIR/indexing_slicing.rs:77:6
278 = help: Consider using `.get(..n)`or `.get_mut(..n)` instead
280 error: indexing may panic.
281 --> $DIR/indexing_slicing.rs:89:5
286 = help: Consider using `.get(n)` or `.get_mut(n)` instead
288 error: indexing may panic.
289 --> $DIR/indexing_slicing.rs:90:5
294 = help: Consider using `.get(n)` or `.get_mut(n)` instead
296 error: range is out of bounds
297 --> $DIR/indexing_slicing.rs:94:13
299 LL | &x[num..10]; // should trigger out of bounds error
302 error: range is out of bounds
303 --> $DIR/indexing_slicing.rs:95:8
305 LL | &x[10..num]; // should trigger out of bounds error
308 error: aborting due to 43 previous errors