Skip to content

Commit a94f684

Browse files
Add error explanation for E0515
1 parent 8fee548 commit a94f684

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/librustc_trans/diagnostics.rs

+15
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,21 @@
1212

1313
register_long_diagnostics! {
1414

15+
E0515: r##"
16+
A constant index expression was out of bounds. Erroneous code example:
17+
18+
```
19+
let x = &[0, 1, 2][7]; // error: const index-expr is out of bounds
20+
```
21+
22+
Please specify a valid index (not inferior to 0 or superior to array length).
23+
Example:
24+
25+
```
26+
let x = &[0, 1, 2][2]; // ok!
27+
```
28+
"##,
29+
1530
}
1631

1732
register_diagnostics! {

0 commit comments

Comments
 (0)