1
+ error: this operation will panic at runtime
2
+ --> $DIR/indexing_slicing_index.rs:23:5
3
+ |
4
+ LL | x[4]; // Ok, let rustc's `unconditional_panic` lint handle `usize` indexing on arrays.
5
+ | ^^^^ index out of bounds: the length is 4 but the index is 4
6
+ |
7
+ = note: `#[deny(unconditional_panic)]` on by default
8
+
9
+ error: this operation will panic at runtime
10
+ --> $DIR/indexing_slicing_index.rs:24:5
11
+ |
12
+ LL | x[1 << 3]; // Ok, let rustc's `unconditional_panic` lint handle `usize` indexing on arrays.
13
+ | ^^^^^^^^^ index out of bounds: the length is 4 but the index is 8
14
+
15
+ error: this operation will panic at runtime
16
+ --> $DIR/indexing_slicing_index.rs:29:5
17
+ |
18
+ LL | x[const { idx4() }]; // Ok, let rustc's `unconditional_panic` lint handle `usize` indexing on arrays.
19
+ | ^^^^^^^^^^^^^^^^^^^ index out of bounds: the length is 4 but the index is 4
20
+
1
21
error[E0080]: evaluation of `main::{constant#3}` failed
2
22
--> $DIR/indexing_slicing_index.rs:31:14
3
23
|
@@ -10,6 +30,18 @@ error[E0080]: erroneous constant used
10
30
LL | const { &ARR[idx4()] }; // Ok, let rustc handle const contexts.
11
31
| ^^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors
12
32
33
+ error: this operation will panic at runtime
34
+ --> $DIR/indexing_slicing_index.rs:35:5
35
+ |
36
+ LL | y[4]; // Ok, rustc will handle references too.
37
+ | ^^^^ index out of bounds: the length is 4 but the index is 4
38
+
39
+ error: this operation will panic at runtime
40
+ --> $DIR/indexing_slicing_index.rs:44:5
41
+ |
42
+ LL | x[N]; // Ok, let rustc's `unconditional_panic` lint handle `usize` indexing on arrays.
43
+ | ^^^^ index out of bounds: the length is 4 but the index is 15
44
+
13
45
error: indexing may panic
14
46
--> $DIR/indexing_slicing_index.rs:22:5
15
47
|
@@ -59,6 +91,6 @@ LL | v[M];
59
91
|
60
92
= help: consider using `.get(n)` or `.get_mut(n)` instead
61
93
62
- error: aborting due to 8 previous errors
94
+ error: aborting due to 13 previous errors
63
95
64
96
For more information about this error, try `rustc --explain E0080`.
0 commit comments