]> git.lizzy.rs Git - rust.git/blob - tests/ui/indexing_slicing.stderr
Auto merge of #4314 - chansuke:add-negation-to-is_empty, r=flip1995
[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:18: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:19: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 4 but the index is 15
16   --> $DIR/indexing_slicing.rs:54:5
17    |
18 LL |     x[N]; // Ok, let rustc's `const_err` lint handle `usize` indexing on arrays.
19    |     ^^^^
20
21 error: indexing may panic.
22   --> $DIR/indexing_slicing.rs:13:5
23    |
24 LL |     x[index];
25    |     ^^^^^^^^
26    |
27    = note: `-D clippy::indexing-slicing` implied by `-D warnings`
28    = help: Consider using `.get(n)` or `.get_mut(n)` instead
29
30 error: slicing may panic.
31   --> $DIR/indexing_slicing.rs:14:6
32    |
33 LL |     &x[index..];
34    |      ^^^^^^^^^^
35    |
36    = help: Consider using `.get(n..)` or .get_mut(n..)` instead
37
38 error: slicing may panic.
39   --> $DIR/indexing_slicing.rs:15:6
40    |
41 LL |     &x[..index];
42    |      ^^^^^^^^^^
43    |
44    = help: Consider using `.get(..n)`or `.get_mut(..n)` instead
45
46 error: slicing may panic.
47   --> $DIR/indexing_slicing.rs:16:6
48    |
49 LL |     &x[index_from..index_to];
50    |      ^^^^^^^^^^^^^^^^^^^^^^^
51    |
52    = help: Consider using `.get(n..m)` or `.get_mut(n..m)` instead
53
54 error: slicing may panic.
55   --> $DIR/indexing_slicing.rs:17:6
56    |
57 LL |     &x[index_from..][..index_to]; // Two lint reports, one for [index_from..] and another for [..index_to].
58    |      ^^^^^^^^^^^^^^^^^^^^^^^^^^^
59    |
60    = help: Consider using `.get(..n)`or `.get_mut(..n)` instead
61
62 error: slicing may panic.
63   --> $DIR/indexing_slicing.rs:17:6
64    |
65 LL |     &x[index_from..][..index_to]; // Two lint reports, one for [index_from..] and another for [..index_to].
66    |      ^^^^^^^^^^^^^^^
67    |
68    = help: Consider using `.get(n..)` or .get_mut(n..)` instead
69
70 error: slicing may panic.
71   --> $DIR/indexing_slicing.rs:20:6
72    |
73 LL |     &x[5..][..10]; // Two lint reports, one for out of bounds [5..] and another for slicing [..10].
74    |      ^^^^^^^^^^^^
75    |
76    = help: Consider using `.get(..n)`or `.get_mut(..n)` instead
77
78 error: range is out of bounds
79   --> $DIR/indexing_slicing.rs:20:8
80    |
81 LL |     &x[5..][..10]; // Two lint reports, one for out of bounds [5..] and another for slicing [..10].
82    |        ^
83    |
84    = note: `-D clippy::out-of-bounds-indexing` implied by `-D warnings`
85
86 error: slicing may panic.
87   --> $DIR/indexing_slicing.rs:21:6
88    |
89 LL |     &x[0..][..3];
90    |      ^^^^^^^^^^^
91    |
92    = help: Consider using `.get(..n)`or `.get_mut(..n)` instead
93
94 error: slicing may panic.
95   --> $DIR/indexing_slicing.rs:22:6
96    |
97 LL |     &x[1..][..5];
98    |      ^^^^^^^^^^^
99    |
100    = help: Consider using `.get(..n)`or `.get_mut(..n)` instead
101
102 error: indexing may panic.
103   --> $DIR/indexing_slicing.rs:30:5
104    |
105 LL |     y[0];
106    |     ^^^^
107    |
108    = help: Consider using `.get(n)` or `.get_mut(n)` instead
109
110 error: slicing may panic.
111   --> $DIR/indexing_slicing.rs:31:6
112    |
113 LL |     &y[1..2];
114    |      ^^^^^^^
115    |
116    = help: Consider using `.get(n..m)` or `.get_mut(n..m)` instead
117
118 error: slicing may panic.
119   --> $DIR/indexing_slicing.rs:32:6
120    |
121 LL |     &y[0..=4];
122    |      ^^^^^^^^
123    |
124    = help: Consider using `.get(n..m)` or `.get_mut(n..m)` instead
125
126 error: slicing may panic.
127   --> $DIR/indexing_slicing.rs:33:6
128    |
129 LL |     &y[..=4];
130    |      ^^^^^^^
131    |
132    = help: Consider using `.get(..n)`or `.get_mut(..n)` instead
133
134 error: indexing may panic.
135   --> $DIR/indexing_slicing.rs:38:5
136    |
137 LL |     v[0];
138    |     ^^^^
139    |
140    = help: Consider using `.get(n)` or `.get_mut(n)` instead
141
142 error: indexing may panic.
143   --> $DIR/indexing_slicing.rs:39:5
144    |
145 LL |     v[10];
146    |     ^^^^^
147    |
148    = help: Consider using `.get(n)` or `.get_mut(n)` instead
149
150 error: indexing may panic.
151   --> $DIR/indexing_slicing.rs:40:5
152    |
153 LL |     v[1 << 3];
154    |     ^^^^^^^^^
155    |
156    = help: Consider using `.get(n)` or `.get_mut(n)` instead
157
158 error: slicing may panic.
159   --> $DIR/indexing_slicing.rs:41:6
160    |
161 LL |     &v[10..100];
162    |      ^^^^^^^^^^
163    |
164    = help: Consider using `.get(n..m)` or `.get_mut(n..m)` instead
165
166 error: slicing may panic.
167   --> $DIR/indexing_slicing.rs:42:6
168    |
169 LL |     &x[10..][..100]; // Two lint reports, one for [10..] and another for [..100].
170    |      ^^^^^^^^^^^^^^
171    |
172    = help: Consider using `.get(..n)`or `.get_mut(..n)` instead
173
174 error: range is out of bounds
175   --> $DIR/indexing_slicing.rs:42:8
176    |
177 LL |     &x[10..][..100]; // Two lint reports, one for [10..] and another for [..100].
178    |        ^^
179
180 error: slicing may panic.
181   --> $DIR/indexing_slicing.rs:43:6
182    |
183 LL |     &v[10..];
184    |      ^^^^^^^
185    |
186    = help: Consider using `.get(n..)` or .get_mut(n..)` instead
187
188 error: slicing may panic.
189   --> $DIR/indexing_slicing.rs:44:6
190    |
191 LL |     &v[..100];
192    |      ^^^^^^^^
193    |
194    = help: Consider using `.get(..n)`or `.get_mut(..n)` instead
195
196 error: indexing may panic.
197   --> $DIR/indexing_slicing.rs:56:5
198    |
199 LL |     v[N];
200    |     ^^^^
201    |
202    = help: Consider using `.get(n)` or `.get_mut(n)` instead
203
204 error: indexing may panic.
205   --> $DIR/indexing_slicing.rs:57:5
206    |
207 LL |     v[M];
208    |     ^^^^
209    |
210    = help: Consider using `.get(n)` or `.get_mut(n)` instead
211
212 error: aborting due to 27 previous errors
213