@@ -61,14 +61,6 @@ error: range is out of bounds
61
61
20 | &x[1..5];
62
62
| ^^^^^^^
63
63
64
- error: slicing may panic.
65
- --> $DIR/indexing_slicing.rs:20:6
66
- |
67
- 20 | &x[1..5];
68
- | ^^^^^^^
69
- |
70
- = help: Consider using `.get(n..m)` or `.get_mut(n..m)` instead
71
-
72
64
error: slicing may panic.
73
65
--> $DIR/indexing_slicing.rs:21:6
74
66
|
@@ -91,181 +83,123 @@ error: range is out of bounds
91
83
26 | &x[..=4];
92
84
| ^^^^^^^
93
85
94
- error: slicing may panic.
95
- --> $DIR/indexing_slicing.rs:26:6
96
- |
97
- 26 | &x[..=4];
98
- | ^^^^^^^
99
- |
100
- = help: Consider using `.get(..n)`or `.get_mut(..n)` instead
101
-
102
86
error: range is out of bounds
103
87
--> $DIR/indexing_slicing.rs:30:6
104
88
|
105
89
30 | &x[5..];
106
90
| ^^^^^^
107
91
108
- error: slicing may panic.
109
- --> $DIR/indexing_slicing.rs:30:6
110
- |
111
- 30 | &x[5..];
112
- | ^^^^^^
113
- |
114
- = help: Consider using `.get(n..)` or .get_mut(n..)` instead
115
-
116
92
error: range is out of bounds
117
93
--> $DIR/indexing_slicing.rs:32:6
118
94
|
119
95
32 | &x[..5];
120
96
| ^^^^^^
121
97
122
- error: slicing may panic.
123
- --> $DIR/indexing_slicing.rs:32 :6
98
+ error: range is out of bounds
99
+ --> $DIR/indexing_slicing.rs:33 :6
124
100
|
125
- 32 | &x[..5] ;
101
+ 33 | &x[5..].iter().map(|x| 2 * x).collect::<Vec<i32>>() ;
126
102
| ^^^^^^
127
- |
128
- = help: Consider using `.get(..n)`or `.get_mut(..n)` instead
129
103
130
104
error: indexing may panic.
131
- --> $DIR/indexing_slicing.rs:35 :5
105
+ --> $DIR/indexing_slicing.rs:37 :5
132
106
|
133
- 35 | y[0];
107
+ 37 | y[0];
134
108
| ^^^^
135
109
|
136
110
= help: Consider using `.get(n)` or `.get_mut(n)` instead
137
111
138
112
error: slicing may panic.
139
- --> $DIR/indexing_slicing.rs:36 :6
113
+ --> $DIR/indexing_slicing.rs:38 :6
140
114
|
141
- 36 | &y[1..2];
115
+ 38 | &y[1..2];
142
116
| ^^^^^^^
143
117
|
144
118
= help: Consider using `.get(n..m)` or `.get_mut(n..m)` instead
145
119
146
120
error: slicing may panic.
147
- --> $DIR/indexing_slicing.rs:39 :6
121
+ --> $DIR/indexing_slicing.rs:41 :6
148
122
|
149
- 39 | &y[..=4];
123
+ 41 | &y[..=4];
150
124
| ^^^^^^^
151
125
|
152
126
= help: Consider using `.get(..n)`or `.get_mut(..n)` instead
153
127
154
128
error: const index is out of bounds
155
- --> $DIR/indexing_slicing.rs:42 :5
129
+ --> $DIR/indexing_slicing.rs:44 :5
156
130
|
157
- 42 | empty[0];
131
+ 44 | empty[0];
158
132
| ^^^^^^^^
159
133
160
- error: range is out of bounds
161
- --> $DIR/indexing_slicing.rs:43:6
162
- |
163
- 43 | &empty[1..5];
164
- | ^^^^^^^^^^^
165
-
166
- error: slicing may panic.
167
- --> $DIR/indexing_slicing.rs:43:6
168
- |
169
- 43 | &empty[1..5];
170
- | ^^^^^^^^^^^
171
- |
172
- = help: Consider using `.get(n..m)` or `.get_mut(n..m)` instead
173
-
174
134
error: range is out of bounds
175
135
--> $DIR/indexing_slicing.rs:45:6
176
136
|
177
- 45 | &empty[..=4 ];
137
+ 45 | &empty[1..5 ];
178
138
| ^^^^^^^^^^^
179
139
180
- error: slicing may panic.
181
- --> $DIR/indexing_slicing.rs:45:6
182
- |
183
- 45 | &empty[..=4];
184
- | ^^^^^^^^^^^
185
- |
186
- = help: Consider using `.get(..n)`or `.get_mut(..n)` instead
187
-
188
140
error: range is out of bounds
189
- --> $DIR/indexing_slicing.rs:50:6
190
- |
191
- 50 | &empty[..=0];
192
- | ^^^^^^^^^^^
193
-
194
- error: slicing may panic.
195
- --> $DIR/indexing_slicing.rs:50:6
141
+ --> $DIR/indexing_slicing.rs:47:6
196
142
|
197
- 50 | &empty[..=0 ];
143
+ 47 | &empty[..=4 ];
198
144
| ^^^^^^^^^^^
199
- |
200
- = help: Consider using `.get(..n)`or `.get_mut(..n)` instead
201
145
202
146
error: range is out of bounds
203
147
--> $DIR/indexing_slicing.rs:52:6
204
148
|
205
- 52 | &empty[1..];
206
- | ^^^^^^^^^^
207
-
208
- error: slicing may panic.
209
- --> $DIR/indexing_slicing.rs:52:6
210
- |
211
- 52 | &empty[1..];
212
- | ^^^^^^^^^^
213
- |
214
- = help: Consider using `.get(n..)` or .get_mut(n..)` instead
149
+ 52 | &empty[..=0];
150
+ | ^^^^^^^^^^^
215
151
216
152
error: range is out of bounds
217
- --> $DIR/indexing_slicing.rs:53 :6
153
+ --> $DIR/indexing_slicing.rs:54 :6
218
154
|
219
- 53 | &empty[..4 ];
155
+ 54 | &empty[1.. ];
220
156
| ^^^^^^^^^^
221
157
222
- error: slicing may panic.
223
- --> $DIR/indexing_slicing.rs:53 :6
158
+ error: range is out of bounds
159
+ --> $DIR/indexing_slicing.rs:55 :6
224
160
|
225
- 53 | &empty[..4];
161
+ 55 | &empty[..4];
226
162
| ^^^^^^^^^^
227
- |
228
- = help: Consider using `.get(..n)`or `.get_mut(..n)` instead
229
163
230
164
error: indexing may panic.
231
- --> $DIR/indexing_slicing.rs:56 :5
165
+ --> $DIR/indexing_slicing.rs:58 :5
232
166
|
233
- 56 | v[0];
167
+ 58 | v[0];
234
168
| ^^^^
235
169
|
236
170
= help: Consider using `.get(n)` or `.get_mut(n)` instead
237
171
238
172
error: indexing may panic.
239
- --> $DIR/indexing_slicing.rs:57 :5
173
+ --> $DIR/indexing_slicing.rs:59 :5
240
174
|
241
- 57 | v[10];
175
+ 59 | v[10];
242
176
| ^^^^^
243
177
|
244
178
= help: Consider using `.get(n)` or `.get_mut(n)` instead
245
179
246
180
error: slicing may panic.
247
- --> $DIR/indexing_slicing.rs:58 :6
181
+ --> $DIR/indexing_slicing.rs:60 :6
248
182
|
249
- 58 | &v[10..100];
183
+ 60 | &v[10..100];
250
184
| ^^^^^^^^^^
251
185
|
252
186
= help: Consider using `.get(n..m)` or `.get_mut(n..m)` instead
253
187
254
188
error: slicing may panic.
255
- --> $DIR/indexing_slicing.rs:59 :6
189
+ --> $DIR/indexing_slicing.rs:61 :6
256
190
|
257
- 59 | &v[10..];
191
+ 61 | &v[10..];
258
192
| ^^^^^^^
259
193
|
260
194
= help: Consider using `.get(n..)` or .get_mut(n..)` instead
261
195
262
196
error: slicing may panic.
263
- --> $DIR/indexing_slicing.rs:60 :6
197
+ --> $DIR/indexing_slicing.rs:62 :6
264
198
|
265
- 60 | &v[..100];
199
+ 62 | &v[..100];
266
200
| ^^^^^^^^
267
201
|
268
202
= help: Consider using `.get(..n)`or `.get_mut(..n)` instead
269
203
270
- error: aborting due to 36 previous errors
204
+ error: aborting due to 28 previous errors
271
205
0 commit comments