]> git.lizzy.rs Git - rust.git/blob - tests/ui/indexing_slicing.stderr
Auto merge of #3635 - matthiaskrgr:revert_random_state_3603, r=xfix
[rust.git] / tests / ui / indexing_slicing.stderr
1 error: index out of bounds: the len is 4 but the index is 4
2   --> $DIR/indexing_slicing.rs:25:5
3    |
4 LL |     x[4]; // Ok, let rustc's `const_err` lint handle `usize` indexing on arrays.
5    |     ^^^^
6    |
7    = note: #[deny(const_err)] on by default
8
9 error: index out of bounds: the len is 4 but the index is 8
10   --> $DIR/indexing_slicing.rs:26:5
11    |
12 LL |     x[1 << 3]; // Ok, let rustc's `const_err` lint handle `usize` indexing on arrays.
13    |     ^^^^^^^^^
14
15 error: index out of bounds: the len is 0 but the index is 0
16   --> $DIR/indexing_slicing.rs:56:5
17    |
18 LL |     empty[0]; // Ok, let rustc's `const_err` lint handle `usize` indexing on arrays.
19    |     ^^^^^^^^
20
21 error: index out of bounds: the len is 4 but the index is 15
22   --> $DIR/indexing_slicing.rs:87:5
23    |
24 LL |     x[N]; // Ok, let rustc's `const_err` lint handle `usize` indexing on arrays.
25    |     ^^^^
26
27 error: indexing may panic.
28   --> $DIR/indexing_slicing.rs:20:5
29    |
30 LL |     x[index];
31    |     ^^^^^^^^
32    |
33    = note: `-D clippy::indexing-slicing` implied by `-D warnings`
34    = help: Consider using `.get(n)` or `.get_mut(n)` instead
35
36 error: slicing may panic.
37   --> $DIR/indexing_slicing.rs:21:6
38    |
39 LL |     &x[index..];
40    |      ^^^^^^^^^^
41    |
42    = help: Consider using `.get(n..)` or .get_mut(n..)` instead
43
44 error: slicing may panic.
45   --> $DIR/indexing_slicing.rs:22:6
46    |
47 LL |     &x[..index];
48    |      ^^^^^^^^^^
49    |
50    = help: Consider using `.get(..n)`or `.get_mut(..n)` instead
51
52 error: slicing may panic.
53   --> $DIR/indexing_slicing.rs:23:6
54    |
55 LL |     &x[index_from..index_to];
56    |      ^^^^^^^^^^^^^^^^^^^^^^^
57    |
58    = help: Consider using `.get(n..m)` or `.get_mut(n..m)` instead
59
60 error: slicing may panic.
61   --> $DIR/indexing_slicing.rs:24:6
62    |
63 LL |     &x[index_from..][..index_to]; // Two lint reports, one for [index_from..] and another for [..index_to].
64    |      ^^^^^^^^^^^^^^^^^^^^^^^^^^^
65    |
66    = help: Consider using `.get(..n)`or `.get_mut(..n)` instead
67
68 error: slicing may panic.
69   --> $DIR/indexing_slicing.rs:24:6
70    |
71 LL |     &x[index_from..][..index_to]; // Two lint reports, one for [index_from..] and another for [..index_to].
72    |      ^^^^^^^^^^^^^^^
73    |
74    = help: Consider using `.get(n..)` or .get_mut(n..)` instead
75
76 error: range is out of bounds
77   --> $DIR/indexing_slicing.rs:27:11
78    |
79 LL |     &x[..=4];
80    |           ^
81    |
82    = note: `-D clippy::out-of-bounds-indexing` implied by `-D warnings`
83
84 error: range is out of bounds
85   --> $DIR/indexing_slicing.rs:28:11
86    |
87 LL |     &x[1..5];
88    |           ^
89
90 error: slicing may panic.
91   --> $DIR/indexing_slicing.rs:29:6
92    |
93 LL |     &x[5..][..10]; // Two lint reports, one for [5..] and another for [..10].
94    |      ^^^^^^^^^^^^
95    |
96    = help: Consider using `.get(..n)`or `.get_mut(..n)` instead
97
98 error: range is out of bounds
99   --> $DIR/indexing_slicing.rs:29:8
100    |
101 LL |     &x[5..][..10]; // Two lint reports, one for [5..] and another for [..10].
102    |        ^
103
104 error: range is out of bounds
105   --> $DIR/indexing_slicing.rs:30:8
106    |
107 LL |     &x[5..];
108    |        ^
109
110 error: range is out of bounds
111   --> $DIR/indexing_slicing.rs:31:10
112    |
113 LL |     &x[..5];
114    |          ^
115
116 error: range is out of bounds
117   --> $DIR/indexing_slicing.rs:32:8
118    |
119 LL |     &x[5..].iter().map(|x| 2 * x).collect::<Vec<i32>>();
120    |        ^
121
122 error: range is out of bounds
123   --> $DIR/indexing_slicing.rs:33:12
124    |
125 LL |     &x[0..=4];
126    |            ^
127
128 error: slicing may panic.
129   --> $DIR/indexing_slicing.rs:34:6
130    |
131 LL |     &x[0..][..3];
132    |      ^^^^^^^^^^^
133    |
134    = help: Consider using `.get(..n)`or `.get_mut(..n)` instead
135
136 error: slicing may panic.
137   --> $DIR/indexing_slicing.rs:35:6
138    |
139 LL |     &x[1..][..5];
140    |      ^^^^^^^^^^^
141    |
142    = help: Consider using `.get(..n)`or `.get_mut(..n)` instead
143
144 error: indexing may panic.
145   --> $DIR/indexing_slicing.rs:48:5
146    |
147 LL |     y[0];
148    |     ^^^^
149    |
150    = help: Consider using `.get(n)` or `.get_mut(n)` instead
151
152 error: slicing may panic.
153   --> $DIR/indexing_slicing.rs:49:6
154    |
155 LL |     &y[1..2];
156    |      ^^^^^^^
157    |
158    = help: Consider using `.get(n..m)` or `.get_mut(n..m)` instead
159
160 error: slicing may panic.
161   --> $DIR/indexing_slicing.rs:50:6
162    |
163 LL |     &y[0..=4];
164    |      ^^^^^^^^
165    |
166    = help: Consider using `.get(n..m)` or `.get_mut(n..m)` instead
167
168 error: slicing may panic.
169   --> $DIR/indexing_slicing.rs:51:6
170    |
171 LL |     &y[..=4];
172    |      ^^^^^^^
173    |
174    = help: Consider using `.get(..n)`or `.get_mut(..n)` instead
175
176 error: range is out of bounds
177   --> $DIR/indexing_slicing.rs:57:12
178    |
179 LL |     &empty[1..5];
180    |            ^
181
182 error: range is out of bounds
183   --> $DIR/indexing_slicing.rs:58:16
184    |
185 LL |     &empty[0..=4];
186    |                ^
187
188 error: range is out of bounds
189   --> $DIR/indexing_slicing.rs:59:15
190    |
191 LL |     &empty[..=4];
192    |               ^
193
194 error: range is out of bounds
195   --> $DIR/indexing_slicing.rs:60:12
196    |
197 LL |     &empty[1..];
198    |            ^
199
200 error: range is out of bounds
201   --> $DIR/indexing_slicing.rs:61:14
202    |
203 LL |     &empty[..4];
204    |              ^
205
206 error: range is out of bounds
207   --> $DIR/indexing_slicing.rs:62:16
208    |
209 LL |     &empty[0..=0];
210    |                ^
211
212 error: range is out of bounds
213   --> $DIR/indexing_slicing.rs:63:15
214    |
215 LL |     &empty[..=0];
216    |               ^
217
218 error: indexing may panic.
219   --> $DIR/indexing_slicing.rs:71:5
220    |
221 LL |     v[0];
222    |     ^^^^
223    |
224    = help: Consider using `.get(n)` or `.get_mut(n)` instead
225
226 error: indexing may panic.
227   --> $DIR/indexing_slicing.rs:72:5
228    |
229 LL |     v[10];
230    |     ^^^^^
231    |
232    = help: Consider using `.get(n)` or `.get_mut(n)` instead
233
234 error: indexing may panic.
235   --> $DIR/indexing_slicing.rs:73:5
236    |
237 LL |     v[1 << 3];
238    |     ^^^^^^^^^
239    |
240    = help: Consider using `.get(n)` or `.get_mut(n)` instead
241
242 error: slicing may panic.
243   --> $DIR/indexing_slicing.rs:74:6
244    |
245 LL |     &v[10..100];
246    |      ^^^^^^^^^^
247    |
248    = help: Consider using `.get(n..m)` or `.get_mut(n..m)` instead
249
250 error: slicing may panic.
251   --> $DIR/indexing_slicing.rs:75:6
252    |
253 LL |     &x[10..][..100]; // Two lint reports, one for [10..] and another for [..100].
254    |      ^^^^^^^^^^^^^^
255    |
256    = help: Consider using `.get(..n)`or `.get_mut(..n)` instead
257
258 error: range is out of bounds
259   --> $DIR/indexing_slicing.rs:75:8
260    |
261 LL |     &x[10..][..100]; // Two lint reports, one for [10..] and another for [..100].
262    |        ^^
263
264 error: slicing may panic.
265   --> $DIR/indexing_slicing.rs:76:6
266    |
267 LL |     &v[10..];
268    |      ^^^^^^^
269    |
270    = help: Consider using `.get(n..)` or .get_mut(n..)` instead
271
272 error: slicing may panic.
273   --> $DIR/indexing_slicing.rs:77:6
274    |
275 LL |     &v[..100];
276    |      ^^^^^^^^
277    |
278    = help: Consider using `.get(..n)`or `.get_mut(..n)` instead
279
280 error: indexing may panic.
281   --> $DIR/indexing_slicing.rs:89:5
282    |
283 LL |     v[N];
284    |     ^^^^
285    |
286    = help: Consider using `.get(n)` or `.get_mut(n)` instead
287
288 error: indexing may panic.
289   --> $DIR/indexing_slicing.rs:90:5
290    |
291 LL |     v[M];
292    |     ^^^^
293    |
294    = help: Consider using `.get(n)` or `.get_mut(n)` instead
295
296 error: range is out of bounds
297   --> $DIR/indexing_slicing.rs:94:13
298    |
299 LL |     &x[num..10]; // should trigger out of bounds error
300    |             ^^
301
302 error: range is out of bounds
303   --> $DIR/indexing_slicing.rs:95:8
304    |
305 LL |     &x[10..num]; // should trigger out of bounds error
306    |        ^^
307
308 error: aborting due to 43 previous errors
309