rust/tests/ui/indexing_slicing.stderr
Shea Newton c479b3bc28
Removing lint for constant usize array indexing
This commit removes the logic in this PR that linted out-of-bounds constant `usize` indexing on arrays. That case is already handled by rustc's `const_err` lint. Beyond removing the linting logic, the test file and its associated stderr were updated to verify that const `usize` indexing operations on arrays are no longer handled by this `indexing_slicing` lint.
2018-06-19 21:30:43 +00:00

272 lines
6.1 KiB
Plaintext

error: indexing may panic.
--> $DIR/indexing_slicing.rs:11:5
|
11 | x[index];
| ^^^^^^^^
|
= note: `-D indexing-slicing` implied by `-D warnings`
= help: Consider using `.get(n)` or `.get_mut(n)` instead
error: slicing may panic.
--> $DIR/indexing_slicing.rs:12:6
|
12 | &x[index..];
| ^^^^^^^^^^
|
= help: Consider using `.get(n..)` or .get_mut(n..)` instead
error: slicing may panic.
--> $DIR/indexing_slicing.rs:13:6
|
13 | &x[..index];
| ^^^^^^^^^^
|
= help: Consider using `.get(..n)`or `.get_mut(..n)` instead
error: slicing may panic.
--> $DIR/indexing_slicing.rs:14:6
|
14 | &x[index_from..index_to];
| ^^^^^^^^^^^^^^^^^^^^^^^
|
= help: Consider using `.get(n..m)` or `.get_mut(n..m)` instead
error: slicing may panic.
--> $DIR/indexing_slicing.rs:15:6
|
15 | &x[index_from..][..index_to]; // Two lint reports, one for [index_from..] and another for [..index_to].
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: Consider using `.get(..n)`or `.get_mut(..n)` instead
error: slicing may panic.
--> $DIR/indexing_slicing.rs:15:6
|
15 | &x[index_from..][..index_to]; // Two lint reports, one for [index_from..] and another for [..index_to].
| ^^^^^^^^^^^^^^^
|
= help: Consider using `.get(n..)` or .get_mut(n..)` instead
error: range is out of bounds
--> $DIR/indexing_slicing.rs:18:6
|
18 | &x[..=4];
| ^^^^^^^
|
= note: `-D out-of-bounds-indexing` implied by `-D warnings`
error: range is out of bounds
--> $DIR/indexing_slicing.rs:19:6
|
19 | &x[1..5];
| ^^^^^^^
error: slicing may panic.
--> $DIR/indexing_slicing.rs:20:6
|
20 | &x[5..][..10]; // Two lint reports, one for [5..] and another for [..10].
| ^^^^^^^^^^^^
|
= help: Consider using `.get(..n)`or `.get_mut(..n)` instead
error: range is out of bounds
--> $DIR/indexing_slicing.rs:20:6
|
20 | &x[5..][..10]; // Two lint reports, one for [5..] and another for [..10].
| ^^^^^^
error: range is out of bounds
--> $DIR/indexing_slicing.rs:21:6
|
21 | &x[5..];
| ^^^^^^
error: range is out of bounds
--> $DIR/indexing_slicing.rs:22:6
|
22 | &x[..5];
| ^^^^^^
error: range is out of bounds
--> $DIR/indexing_slicing.rs:23:6
|
23 | &x[5..].iter().map(|x| 2 * x).collect::<Vec<i32>>();
| ^^^^^^
error: range is out of bounds
--> $DIR/indexing_slicing.rs:24:6
|
24 | &x[0..=4];
| ^^^^^^^^
error: slicing may panic.
--> $DIR/indexing_slicing.rs:25:6
|
25 | &x[0..][..3];
| ^^^^^^^^^^^
|
= help: Consider using `.get(..n)`or `.get_mut(..n)` instead
error: slicing may panic.
--> $DIR/indexing_slicing.rs:26:6
|
26 | &x[1..][..5];
| ^^^^^^^^^^^
|
= help: Consider using `.get(..n)`or `.get_mut(..n)` instead
error: indexing may panic.
--> $DIR/indexing_slicing.rs:39:5
|
39 | y[0];
| ^^^^
|
= help: Consider using `.get(n)` or `.get_mut(n)` instead
error: slicing may panic.
--> $DIR/indexing_slicing.rs:40:6
|
40 | &y[1..2];
| ^^^^^^^
|
= help: Consider using `.get(n..m)` or `.get_mut(n..m)` instead
error: slicing may panic.
--> $DIR/indexing_slicing.rs:41:6
|
41 | &y[0..=4];
| ^^^^^^^^
|
= help: Consider using `.get(n..m)` or `.get_mut(n..m)` instead
error: slicing may panic.
--> $DIR/indexing_slicing.rs:42:6
|
42 | &y[..=4];
| ^^^^^^^
|
= help: Consider using `.get(..n)`or `.get_mut(..n)` instead
error: range is out of bounds
--> $DIR/indexing_slicing.rs:48:6
|
48 | &empty[1..5];
| ^^^^^^^^^^^
error: range is out of bounds
--> $DIR/indexing_slicing.rs:49:6
|
49 | &empty[0..=4];
| ^^^^^^^^^^^^
error: range is out of bounds
--> $DIR/indexing_slicing.rs:50:6
|
50 | &empty[..=4];
| ^^^^^^^^^^^
error: range is out of bounds
--> $DIR/indexing_slicing.rs:51:6
|
51 | &empty[1..];
| ^^^^^^^^^^
error: range is out of bounds
--> $DIR/indexing_slicing.rs:52:6
|
52 | &empty[..4];
| ^^^^^^^^^^
error: range is out of bounds
--> $DIR/indexing_slicing.rs:53:6
|
53 | &empty[0..=0];
| ^^^^^^^^^^^^
error: range is out of bounds
--> $DIR/indexing_slicing.rs:54:6
|
54 | &empty[..=0];
| ^^^^^^^^^^^
error: indexing may panic.
--> $DIR/indexing_slicing.rs:62:5
|
62 | v[0];
| ^^^^
|
= help: Consider using `.get(n)` or `.get_mut(n)` instead
error: indexing may panic.
--> $DIR/indexing_slicing.rs:63:5
|
63 | v[10];
| ^^^^^
|
= help: Consider using `.get(n)` or `.get_mut(n)` instead
error: indexing may panic.
--> $DIR/indexing_slicing.rs:64:5
|
64 | v[1 << 3];
| ^^^^^^^^^
|
= help: Consider using `.get(n)` or `.get_mut(n)` instead
error: slicing may panic.
--> $DIR/indexing_slicing.rs:65:6
|
65 | &v[10..100];
| ^^^^^^^^^^
|
= help: Consider using `.get(n..m)` or `.get_mut(n..m)` instead
error: slicing may panic.
--> $DIR/indexing_slicing.rs:66:6
|
66 | &x[10..][..100]; // Two lint reports, one for [10..] and another for [..100].
| ^^^^^^^^^^^^^^
|
= help: Consider using `.get(..n)`or `.get_mut(..n)` instead
error: range is out of bounds
--> $DIR/indexing_slicing.rs:66:6
|
66 | &x[10..][..100]; // Two lint reports, one for [10..] and another for [..100].
| ^^^^^^^
error: slicing may panic.
--> $DIR/indexing_slicing.rs:67:6
|
67 | &v[10..];
| ^^^^^^^
|
= help: Consider using `.get(n..)` or .get_mut(n..)` instead
error: slicing may panic.
--> $DIR/indexing_slicing.rs:68:6
|
68 | &v[..100];
| ^^^^^^^^
|
= help: Consider using `.get(..n)`or `.get_mut(..n)` instead
error: indexing may panic.
--> $DIR/indexing_slicing.rs:80:5
|
80 | v[N];
| ^^^^
|
= help: Consider using `.get(n)` or `.get_mut(n)` instead
error: indexing may panic.
--> $DIR/indexing_slicing.rs:81:5
|
81 | v[M];
| ^^^^
|
= help: Consider using `.get(n)` or `.get_mut(n)` instead
error: aborting due to 37 previous errors