2018-10-25 07:59:14 +02:00
|
|
|
error: index out of bounds: the len is 4 but the index is 4
|
2019-07-16 22:26:47 +02:00
|
|
|
--> $DIR/indexing_slicing.rs:18:5
|
2018-10-25 07:59:14 +02:00
|
|
|
|
|
2018-12-27 16:57:55 +01:00
|
|
|
LL | x[4]; // Ok, let rustc's `const_err` lint handle `usize` indexing on arrays.
|
2018-10-25 07:59:14 +02:00
|
|
|
| ^^^^
|
|
|
|
|
|
2019-07-19 00:35:32 +02:00
|
|
|
= note: `#[deny(const_err)]` on by default
|
2018-10-25 07:59:14 +02:00
|
|
|
|
|
|
|
error: index out of bounds: the len is 4 but the index is 8
|
2019-07-16 22:26:47 +02:00
|
|
|
--> $DIR/indexing_slicing.rs:19:5
|
2018-10-25 07:59:14 +02:00
|
|
|
|
|
2018-12-27 16:57:55 +01:00
|
|
|
LL | x[1 << 3]; // Ok, let rustc's `const_err` lint handle `usize` indexing on arrays.
|
2018-10-25 07:59:14 +02:00
|
|
|
| ^^^^^^^^^
|
|
|
|
|
|
|
|
error: index out of bounds: the len is 4 but the index is 15
|
2019-07-16 22:26:47 +02:00
|
|
|
--> $DIR/indexing_slicing.rs:54:5
|
2018-10-25 07:59:14 +02:00
|
|
|
|
|
2018-12-27 16:57:55 +01:00
|
|
|
LL | x[N]; // Ok, let rustc's `const_err` lint handle `usize` indexing on arrays.
|
2018-10-25 07:59:14 +02:00
|
|
|
| ^^^^
|
|
|
|
|
2018-06-14 01:28:57 +02:00
|
|
|
error: indexing may panic.
|
2019-07-16 22:26:47 +02:00
|
|
|
--> $DIR/indexing_slicing.rs:13:5
|
2018-05-23 06:56:02 +02:00
|
|
|
|
|
2018-12-27 16:57:55 +01:00
|
|
|
LL | x[index];
|
2018-05-23 06:56:02 +02:00
|
|
|
| ^^^^^^^^
|
|
|
|
|
|
2018-08-01 16:30:44 +02:00
|
|
|
= note: `-D clippy::indexing-slicing` implied by `-D warnings`
|
2018-06-14 01:28:57 +02:00
|
|
|
= help: Consider using `.get(n)` or `.get_mut(n)` instead
|
2018-05-23 06:56:02 +02:00
|
|
|
|
2018-06-14 01:28:57 +02:00
|
|
|
error: slicing may panic.
|
2019-07-16 22:26:47 +02:00
|
|
|
--> $DIR/indexing_slicing.rs:14:6
|
2018-05-23 06:56:02 +02:00
|
|
|
|
|
2018-12-27 16:57:55 +01:00
|
|
|
LL | &x[index..];
|
2018-06-14 22:04:37 +02:00
|
|
|
| ^^^^^^^^^^
|
2018-06-14 01:28:57 +02:00
|
|
|
|
|
2018-06-14 22:04:37 +02:00
|
|
|
= help: Consider using `.get(n..)` or .get_mut(n..)` instead
|
2018-05-23 06:56:02 +02:00
|
|
|
|
2018-06-14 01:28:57 +02:00
|
|
|
error: slicing may panic.
|
2019-07-16 22:26:47 +02:00
|
|
|
--> $DIR/indexing_slicing.rs:15:6
|
2018-05-23 06:56:02 +02:00
|
|
|
|
|
2018-12-27 16:57:55 +01:00
|
|
|
LL | &x[..index];
|
2018-06-14 22:04:37 +02:00
|
|
|
| ^^^^^^^^^^
|
2018-06-14 01:28:57 +02:00
|
|
|
|
|
|
|
|
= help: Consider using `.get(..n)`or `.get_mut(..n)` instead
|
2018-05-23 06:56:02 +02:00
|
|
|
|
2018-06-14 01:28:57 +02:00
|
|
|
error: slicing may panic.
|
2019-07-16 22:26:47 +02:00
|
|
|
--> $DIR/indexing_slicing.rs:16:6
|
2018-05-23 06:56:02 +02:00
|
|
|
|
|
2018-12-27 16:57:55 +01:00
|
|
|
LL | &x[index_from..index_to];
|
2018-06-14 22:04:37 +02:00
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^
|
2018-06-14 01:28:57 +02:00
|
|
|
|
|
2018-06-14 22:04:37 +02:00
|
|
|
= help: Consider using `.get(n..m)` or `.get_mut(n..m)` instead
|
2018-05-23 06:56:02 +02:00
|
|
|
|
2018-06-14 01:28:57 +02:00
|
|
|
error: slicing may panic.
|
2019-07-16 22:26:47 +02:00
|
|
|
--> $DIR/indexing_slicing.rs:17:6
|
2018-05-23 06:56:02 +02:00
|
|
|
|
|
2018-12-27 16:57:55 +01:00
|
|
|
LL | &x[index_from..][..index_to]; // Two lint reports, one for [index_from..] and another for [..index_to].
|
2018-06-14 22:04:37 +02:00
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
2018-06-14 01:28:57 +02:00
|
|
|
|
|
2018-06-14 22:04:37 +02:00
|
|
|
= help: Consider using `.get(..n)`or `.get_mut(..n)` instead
|
2018-05-23 06:56:02 +02:00
|
|
|
|
2018-06-14 01:28:57 +02:00
|
|
|
error: slicing may panic.
|
2019-07-16 22:26:47 +02:00
|
|
|
--> $DIR/indexing_slicing.rs:17:6
|
2018-05-23 06:56:02 +02:00
|
|
|
|
|
2018-12-27 16:57:55 +01:00
|
|
|
LL | &x[index_from..][..index_to]; // Two lint reports, one for [index_from..] and another for [..index_to].
|
2018-06-14 22:04:37 +02:00
|
|
|
| ^^^^^^^^^^^^^^^
|
2018-06-14 01:28:57 +02:00
|
|
|
|
|
2018-06-14 22:04:37 +02:00
|
|
|
= help: Consider using `.get(n..)` or .get_mut(n..)` instead
|
2018-05-23 06:56:02 +02:00
|
|
|
|
2018-06-14 01:28:57 +02:00
|
|
|
error: slicing may panic.
|
2019-07-16 22:26:47 +02:00
|
|
|
--> $DIR/indexing_slicing.rs:20:6
|
2018-05-23 06:56:02 +02:00
|
|
|
|
|
2019-07-16 07:30:23 +02:00
|
|
|
LL | &x[5..][..10]; // Two lint reports, one for out of bounds [5..] and another for slicing [..10].
|
2018-06-14 22:04:37 +02:00
|
|
|
| ^^^^^^^^^^^^
|
2018-06-14 01:28:57 +02:00
|
|
|
|
|
|
|
|
= help: Consider using `.get(..n)`or `.get_mut(..n)` instead
|
2017-05-17 14:19:44 +02:00
|
|
|
|
|
|
|
error: range is out of bounds
|
2019-07-16 22:26:47 +02:00
|
|
|
--> $DIR/indexing_slicing.rs:20:8
|
2017-05-17 14:19:44 +02:00
|
|
|
|
|
2019-07-16 07:30:23 +02:00
|
|
|
LL | &x[5..][..10]; // Two lint reports, one for out of bounds [5..] and another for slicing [..10].
|
2018-10-15 13:44:39 +02:00
|
|
|
| ^
|
2017-05-17 14:19:44 +02:00
|
|
|
|
|
2019-07-16 07:30:23 +02:00
|
|
|
= note: `-D clippy::out-of-bounds-indexing` implied by `-D warnings`
|
2018-06-14 22:04:37 +02:00
|
|
|
|
|
|
|
error: slicing may panic.
|
2019-07-16 22:26:47 +02:00
|
|
|
--> $DIR/indexing_slicing.rs:21:6
|
2018-06-14 22:04:37 +02:00
|
|
|
|
|
2018-12-27 16:57:55 +01:00
|
|
|
LL | &x[0..][..3];
|
2018-06-14 22:04:37 +02:00
|
|
|
| ^^^^^^^^^^^
|
|
|
|
|
|
|
|
|
= help: Consider using `.get(..n)`or `.get_mut(..n)` instead
|
|
|
|
|
|
|
|
error: slicing may panic.
|
2019-07-16 22:26:47 +02:00
|
|
|
--> $DIR/indexing_slicing.rs:22:6
|
2018-06-14 22:04:37 +02:00
|
|
|
|
|
2018-12-27 16:57:55 +01:00
|
|
|
LL | &x[1..][..5];
|
2018-06-14 22:04:37 +02:00
|
|
|
| ^^^^^^^^^^^
|
|
|
|
|
|
|
|
|
= help: Consider using `.get(..n)`or `.get_mut(..n)` instead
|
|
|
|
|
2018-06-14 01:28:57 +02:00
|
|
|
error: indexing may panic.
|
2019-07-16 22:26:47 +02:00
|
|
|
--> $DIR/indexing_slicing.rs:30:5
|
2017-05-17 14:19:44 +02:00
|
|
|
|
|
2018-12-27 16:57:55 +01:00
|
|
|
LL | y[0];
|
2018-05-23 06:56:02 +02:00
|
|
|
| ^^^^
|
2018-06-14 01:28:57 +02:00
|
|
|
|
|
|
|
|
= help: Consider using `.get(n)` or `.get_mut(n)` instead
|
2017-05-17 14:19:44 +02:00
|
|
|
|
2018-06-14 01:28:57 +02:00
|
|
|
error: slicing may panic.
|
2019-07-16 22:26:47 +02:00
|
|
|
--> $DIR/indexing_slicing.rs:31:6
|
2017-05-17 14:19:44 +02:00
|
|
|
|
|
2018-12-27 16:57:55 +01:00
|
|
|
LL | &y[1..2];
|
2018-05-23 06:56:02 +02:00
|
|
|
| ^^^^^^^
|
2018-06-14 01:28:57 +02:00
|
|
|
|
|
|
|
|
= help: Consider using `.get(n..m)` or `.get_mut(n..m)` instead
|
2017-05-17 14:19:44 +02:00
|
|
|
|
2018-06-14 01:28:57 +02:00
|
|
|
error: slicing may panic.
|
2019-07-16 22:26:47 +02:00
|
|
|
--> $DIR/indexing_slicing.rs:32:6
|
2017-05-17 14:19:44 +02:00
|
|
|
|
|
2018-12-27 16:57:55 +01:00
|
|
|
LL | &y[0..=4];
|
2018-06-14 22:04:37 +02:00
|
|
|
| ^^^^^^^^
|
|
|
|
|
|
|
|
|
= help: Consider using `.get(n..m)` or `.get_mut(n..m)` instead
|
|
|
|
|
|
|
|
error: slicing may panic.
|
2019-07-16 22:26:47 +02:00
|
|
|
--> $DIR/indexing_slicing.rs:33:6
|
2018-06-14 22:04:37 +02:00
|
|
|
|
|
2018-12-27 16:57:55 +01:00
|
|
|
LL | &y[..=4];
|
2017-05-17 14:19:44 +02:00
|
|
|
| ^^^^^^^
|
2018-06-14 01:28:57 +02:00
|
|
|
|
|
|
|
|
= help: Consider using `.get(..n)`or `.get_mut(..n)` instead
|
2017-05-17 14:19:44 +02:00
|
|
|
|
2018-06-14 01:28:57 +02:00
|
|
|
error: indexing may panic.
|
2019-07-16 22:26:47 +02:00
|
|
|
--> $DIR/indexing_slicing.rs:38:5
|
2018-05-23 06:56:02 +02:00
|
|
|
|
|
2018-12-27 16:57:55 +01:00
|
|
|
LL | v[0];
|
2018-05-23 06:56:02 +02:00
|
|
|
| ^^^^
|
2018-06-14 01:28:57 +02:00
|
|
|
|
|
|
|
|
= help: Consider using `.get(n)` or `.get_mut(n)` instead
|
2018-05-23 06:56:02 +02:00
|
|
|
|
2018-06-14 01:28:57 +02:00
|
|
|
error: indexing may panic.
|
2019-07-16 22:26:47 +02:00
|
|
|
--> $DIR/indexing_slicing.rs:39:5
|
2017-05-17 14:19:44 +02:00
|
|
|
|
|
2018-12-27 16:57:55 +01:00
|
|
|
LL | v[10];
|
2018-05-23 06:56:02 +02:00
|
|
|
| ^^^^^
|
2018-06-14 01:28:57 +02:00
|
|
|
|
|
|
|
|
= help: Consider using `.get(n)` or `.get_mut(n)` instead
|
2018-05-23 06:56:02 +02:00
|
|
|
|
2018-06-14 22:04:37 +02:00
|
|
|
error: indexing may panic.
|
2019-07-16 22:26:47 +02:00
|
|
|
--> $DIR/indexing_slicing.rs:40:5
|
2018-06-14 22:04:37 +02:00
|
|
|
|
|
2018-12-27 16:57:55 +01:00
|
|
|
LL | v[1 << 3];
|
2018-06-14 22:04:37 +02:00
|
|
|
| ^^^^^^^^^
|
|
|
|
|
|
|
|
|
= help: Consider using `.get(n)` or `.get_mut(n)` instead
|
|
|
|
|
2018-06-14 01:28:57 +02:00
|
|
|
error: slicing may panic.
|
2019-07-16 22:26:47 +02:00
|
|
|
--> $DIR/indexing_slicing.rs:41:6
|
2018-05-23 06:56:02 +02:00
|
|
|
|
|
2018-12-27 16:57:55 +01:00
|
|
|
LL | &v[10..100];
|
2017-05-17 14:19:44 +02:00
|
|
|
| ^^^^^^^^^^
|
2018-06-14 01:28:57 +02:00
|
|
|
|
|
|
|
|
= help: Consider using `.get(n..m)` or `.get_mut(n..m)` instead
|
2017-05-17 14:19:44 +02:00
|
|
|
|
2018-06-14 01:28:57 +02:00
|
|
|
error: slicing may panic.
|
2019-07-16 22:26:47 +02:00
|
|
|
--> $DIR/indexing_slicing.rs:42:6
|
2018-06-14 22:04:37 +02:00
|
|
|
|
|
2018-12-27 16:57:55 +01:00
|
|
|
LL | &x[10..][..100]; // Two lint reports, one for [10..] and another for [..100].
|
2018-06-14 22:04:37 +02:00
|
|
|
| ^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
|
= help: Consider using `.get(..n)`or `.get_mut(..n)` instead
|
|
|
|
|
|
|
|
error: range is out of bounds
|
2019-07-16 22:26:47 +02:00
|
|
|
--> $DIR/indexing_slicing.rs:42:8
|
2018-06-14 22:04:37 +02:00
|
|
|
|
|
2018-12-27 16:57:55 +01:00
|
|
|
LL | &x[10..][..100]; // Two lint reports, one for [10..] and another for [..100].
|
2018-10-15 13:44:39 +02:00
|
|
|
| ^^
|
2018-06-14 22:04:37 +02:00
|
|
|
|
|
|
|
error: slicing may panic.
|
2019-07-16 22:26:47 +02:00
|
|
|
--> $DIR/indexing_slicing.rs:43:6
|
2018-05-23 06:56:02 +02:00
|
|
|
|
|
2018-12-27 16:57:55 +01:00
|
|
|
LL | &v[10..];
|
2018-05-23 06:56:02 +02:00
|
|
|
| ^^^^^^^
|
2018-06-14 01:28:57 +02:00
|
|
|
|
|
|
|
|
= help: Consider using `.get(n..)` or .get_mut(n..)` instead
|
2018-05-23 06:56:02 +02:00
|
|
|
|
2018-06-14 01:28:57 +02:00
|
|
|
error: slicing may panic.
|
2019-07-16 22:26:47 +02:00
|
|
|
--> $DIR/indexing_slicing.rs:44:6
|
2018-05-23 06:56:02 +02:00
|
|
|
|
|
2018-12-27 16:57:55 +01:00
|
|
|
LL | &v[..100];
|
2018-05-23 06:56:02 +02:00
|
|
|
| ^^^^^^^^
|
2018-06-14 01:28:57 +02:00
|
|
|
|
|
|
|
|
= help: Consider using `.get(..n)`or `.get_mut(..n)` instead
|
2018-05-23 06:56:02 +02:00
|
|
|
|
2018-06-15 17:54:38 +02:00
|
|
|
error: indexing may panic.
|
2019-07-16 22:26:47 +02:00
|
|
|
--> $DIR/indexing_slicing.rs:56:5
|
2018-06-15 17:54:38 +02:00
|
|
|
|
|
2018-12-27 16:57:55 +01:00
|
|
|
LL | v[N];
|
2018-06-15 17:54:38 +02:00
|
|
|
| ^^^^
|
|
|
|
|
|
|
|
|
= help: Consider using `.get(n)` or `.get_mut(n)` instead
|
|
|
|
|
|
|
|
error: indexing may panic.
|
2019-07-16 22:26:47 +02:00
|
|
|
--> $DIR/indexing_slicing.rs:57:5
|
2018-06-15 17:54:38 +02:00
|
|
|
|
|
2018-12-27 16:57:55 +01:00
|
|
|
LL | v[M];
|
2018-06-15 17:54:38 +02:00
|
|
|
| ^^^^
|
|
|
|
|
|
|
|
|
= help: Consider using `.get(n)` or `.get_mut(n)` instead
|
|
|
|
|
2019-07-16 07:30:23 +02:00
|
|
|
error: aborting due to 27 previous errors
|
2018-01-16 17:06:27 +01:00
|
|
|
|