Skip to content

Commit ddf63cb

Browse files
committed
Auto merge of #4626 - phansch:restore_test, r=<try>
Revert "Remove tests that only ICE on CI" This reverts commit 4318854. If the integration tests pass, this closes #4607
2 parents b824f02 + 8a780c8 commit ddf63cb

File tree

2 files changed

+65
-0
lines changed

2 files changed

+65
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#![warn(clippy::out_of_bounds_indexing)]
2+
#![allow(clippy::no_effect, clippy::unnecessary_operation, const_err)]
3+
4+
fn main() {
5+
let empty: [i8; 0] = [];
6+
empty[0];
7+
&empty[1..5];
8+
&empty[0..=4];
9+
&empty[..=4];
10+
&empty[1..];
11+
&empty[..4];
12+
&empty[0..=0];
13+
&empty[..=0];
14+
15+
&empty[0..]; // Ok, should not produce stderr.
16+
&empty[0..0]; // Ok, should not produce stderr.
17+
&empty[..0]; // Ok, should not produce stderr.
18+
&empty[..]; // Ok, should not produce stderr.
19+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
error: range is out of bounds
2+
--> $DIR/empty_array.rs:7:12
3+
|
4+
LL | &empty[1..5];
5+
| ^
6+
|
7+
= note: `-D clippy::out-of-bounds-indexing` implied by `-D warnings`
8+
9+
error: range is out of bounds
10+
--> $DIR/empty_array.rs:8:16
11+
|
12+
LL | &empty[0..=4];
13+
| ^
14+
15+
error: range is out of bounds
16+
--> $DIR/empty_array.rs:9:15
17+
|
18+
LL | &empty[..=4];
19+
| ^
20+
21+
error: range is out of bounds
22+
--> $DIR/empty_array.rs:10:12
23+
|
24+
LL | &empty[1..];
25+
| ^
26+
27+
error: range is out of bounds
28+
--> $DIR/empty_array.rs:11:14
29+
|
30+
LL | &empty[..4];
31+
| ^
32+
33+
error: range is out of bounds
34+
--> $DIR/empty_array.rs:12:16
35+
|
36+
LL | &empty[0..=0];
37+
| ^
38+
39+
error: range is out of bounds
40+
--> $DIR/empty_array.rs:13:15
41+
|
42+
LL | &empty[..=0];
43+
| ^
44+
45+
error: aborting due to 7 previous errors
46+

0 commit comments

Comments
 (0)