rust/tests/ui/missing_asserts_for_indexing.stderr

257 lines
8.6 KiB
Plaintext
Raw Normal View History

error: indexing into a slice multiple times with an `assert` that does not cover the highest index
--> $DIR/missing_asserts_for_indexing.rs:33:5
|
LL | assert!(v.len() < 5);
| -------------------- help: provide the highest index that is indexed with: `assert!(v.len() > 4)`
LL | //~^ ERROR incorrect length
LL | v[0] + v[1] + v[2] + v[3] + v[4]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: slice indexed here
--> $DIR/missing_asserts_for_indexing.rs:33:5
|
LL | v[0] + v[1] + v[2] + v[3] + v[4]
| ^^^^
note: slice indexed here
--> $DIR/missing_asserts_for_indexing.rs:33:12
|
LL | v[0] + v[1] + v[2] + v[3] + v[4]
| ^^^^
note: slice indexed here
--> $DIR/missing_asserts_for_indexing.rs:33:19
|
LL | v[0] + v[1] + v[2] + v[3] + v[4]
| ^^^^
note: slice indexed here
--> $DIR/missing_asserts_for_indexing.rs:33:26
|
LL | v[0] + v[1] + v[2] + v[3] + v[4]
| ^^^^
note: slice indexed here
--> $DIR/missing_asserts_for_indexing.rs:33:33
|
LL | v[0] + v[1] + v[2] + v[3] + v[4]
| ^^^^
= note: asserting the length before indexing will elide bounds checks
= note: `-D clippy::missing-asserts-for-indexing` implied by `-D warnings`
error: indexing into a slice multiple times with an `assert` that does not cover the highest index
--> $DIR/missing_asserts_for_indexing.rs:39:5
|
LL | assert!(v.len() <= 5);
| --------------------- help: provide the highest index that is indexed with: `assert!(v.len() > 4)`
LL | //~^ ERROR incorrect length
LL | v[0] + v[1] + v[2] + v[3] + v[4]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: slice indexed here
--> $DIR/missing_asserts_for_indexing.rs:39:5
|
LL | v[0] + v[1] + v[2] + v[3] + v[4]
| ^^^^
note: slice indexed here
--> $DIR/missing_asserts_for_indexing.rs:39:12
|
LL | v[0] + v[1] + v[2] + v[3] + v[4]
| ^^^^
note: slice indexed here
--> $DIR/missing_asserts_for_indexing.rs:39:19
|
LL | v[0] + v[1] + v[2] + v[3] + v[4]
| ^^^^
note: slice indexed here
--> $DIR/missing_asserts_for_indexing.rs:39:26
|
LL | v[0] + v[1] + v[2] + v[3] + v[4]
| ^^^^
note: slice indexed here
--> $DIR/missing_asserts_for_indexing.rs:39:33
|
LL | v[0] + v[1] + v[2] + v[3] + v[4]
| ^^^^
= note: asserting the length before indexing will elide bounds checks
error: indexing into a slice multiple times with an `assert` that does not cover the highest index
--> $DIR/missing_asserts_for_indexing.rs:45:5
|
LL | assert!(v.len() > 3);
| -------------------- help: provide the highest index that is indexed with: `assert!(v.len() > 4)`
LL | //~^ ERROR incorrect length
LL | v[0] + v[1] + v[2] + v[3] + v[4]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: slice indexed here
--> $DIR/missing_asserts_for_indexing.rs:45:5
|
LL | v[0] + v[1] + v[2] + v[3] + v[4]
| ^^^^
note: slice indexed here
--> $DIR/missing_asserts_for_indexing.rs:45:12
|
LL | v[0] + v[1] + v[2] + v[3] + v[4]
| ^^^^
note: slice indexed here
--> $DIR/missing_asserts_for_indexing.rs:45:19
|
LL | v[0] + v[1] + v[2] + v[3] + v[4]
| ^^^^
note: slice indexed here
--> $DIR/missing_asserts_for_indexing.rs:45:26
|
LL | v[0] + v[1] + v[2] + v[3] + v[4]
| ^^^^
note: slice indexed here
--> $DIR/missing_asserts_for_indexing.rs:45:33
|
LL | v[0] + v[1] + v[2] + v[3] + v[4]
| ^^^^
= note: asserting the length before indexing will elide bounds checks
error: indexing into a slice multiple times with an `assert` that does not cover the highest index
--> $DIR/missing_asserts_for_indexing.rs:51:5
|
LL | assert!(v.len() >= 4);
| --------------------- help: provide the highest index that is indexed with: `assert!(v.len() > 4)`
LL | //~^ ERROR incorrect length
LL | v[0] + v[1] + v[2] + v[3] + v[4]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: slice indexed here
--> $DIR/missing_asserts_for_indexing.rs:51:5
|
LL | v[0] + v[1] + v[2] + v[3] + v[4]
| ^^^^
note: slice indexed here
--> $DIR/missing_asserts_for_indexing.rs:51:12
|
LL | v[0] + v[1] + v[2] + v[3] + v[4]
| ^^^^
note: slice indexed here
--> $DIR/missing_asserts_for_indexing.rs:51:19
|
LL | v[0] + v[1] + v[2] + v[3] + v[4]
| ^^^^
note: slice indexed here
--> $DIR/missing_asserts_for_indexing.rs:51:26
|
LL | v[0] + v[1] + v[2] + v[3] + v[4]
| ^^^^
note: slice indexed here
--> $DIR/missing_asserts_for_indexing.rs:51:33
|
LL | v[0] + v[1] + v[2] + v[3] + v[4]
| ^^^^
= note: asserting the length before indexing will elide bounds checks
error: indexing into a slice multiple times with an `assert` that does not cover the highest index
--> $DIR/missing_asserts_for_indexing.rs:69:13
|
LL | assert!(v.len() >= 3);
| --------------------- help: provide the highest index that is indexed with: `assert!(v.len() > 3)`
LL | //~^ ERROR incorrect length
LL | let _ = v[0];
| _____________^
LL | | let _ = v[1..4];
| |___________________^
|
note: slice indexed here
--> $DIR/missing_asserts_for_indexing.rs:69:13
|
LL | let _ = v[0];
| ^^^^
note: slice indexed here
--> $DIR/missing_asserts_for_indexing.rs:70:13
|
LL | let _ = v[1..4];
| ^^^^^^^
= note: asserting the length before indexing will elide bounds checks
error: indexing into a slice multiple times with an `assert` that does not cover the highest index
--> $DIR/missing_asserts_for_indexing.rs:83:13
|
LL | assert!(v.len() >= 4);
| --------------------- help: provide the highest index that is indexed with: `assert!(v.len() > 4)`
LL | //~^ ERROR incorrect length
LL | let _ = v[0];
| _____________^
LL | | let _ = v[1..=4];
| |____________________^
|
note: slice indexed here
--> $DIR/missing_asserts_for_indexing.rs:83:13
|
LL | let _ = v[0];
| ^^^^
note: slice indexed here
--> $DIR/missing_asserts_for_indexing.rs:84:13
|
LL | let _ = v[1..=4];
| ^^^^^^^^
= note: asserting the length before indexing will elide bounds checks
error: indexing into a slice multiple times with an `assert` that does not cover the highest index
--> $DIR/missing_asserts_for_indexing.rs:99:13
|
LL | assert!(v1.len() >= 12);
| ----------------------- help: provide the highest index that is indexed with: `assert!(v1.len() > 12)`
...
LL | let _ = v1[0] + v1[12];
| ^^^^^^^^^^^^^^
|
note: slice indexed here
--> $DIR/missing_asserts_for_indexing.rs:99:13
|
LL | let _ = v1[0] + v1[12];
| ^^^^^
note: slice indexed here
--> $DIR/missing_asserts_for_indexing.rs:99:21
|
LL | let _ = v1[0] + v1[12];
| ^^^^^^
= note: asserting the length before indexing will elide bounds checks
error: indexing into a slice multiple times with an `assert` that does not cover the highest index
--> $DIR/missing_asserts_for_indexing.rs:100:13
|
LL | assert!(v2.len() >= 15);
| ----------------------- help: provide the highest index that is indexed with: `assert!(v2.len() > 15)`
...
LL | let _ = v2[5] + v2[15];
| ^^^^^^^^^^^^^^
|
note: slice indexed here
--> $DIR/missing_asserts_for_indexing.rs:100:13
|
LL | let _ = v2[5] + v2[15];
| ^^^^^
note: slice indexed here
--> $DIR/missing_asserts_for_indexing.rs:100:21
|
LL | let _ = v2[5] + v2[15];
| ^^^^^^
= note: asserting the length before indexing will elide bounds checks
error: indexing into a slice multiple times with an `assert` that does not cover the highest index
--> $DIR/missing_asserts_for_indexing.rs:106:13
|
LL | assert!(v1.len() >= 12);
| ----------------------- help: provide the highest index that is indexed with: `assert!(v1.len() > 12)`
...
LL | let _ = v1[0] + v1[12];
| ^^^^^^^^^^^^^^
|
note: slice indexed here
--> $DIR/missing_asserts_for_indexing.rs:106:13
|
LL | let _ = v1[0] + v1[12];
| ^^^^^
note: slice indexed here
--> $DIR/missing_asserts_for_indexing.rs:106:21
|
LL | let _ = v1[0] + v1[12];
| ^^^^^^
= note: asserting the length before indexing will elide bounds checks
error: aborting due to 9 previous errors