mirror of
https://github.com/rust-lang/rust.git
synced 2026-06-02 06:28:20 +03:00
Add error explanation for E0515
This commit is contained in:
@@ -12,6 +12,21 @@
|
||||
|
||||
register_long_diagnostics! {
|
||||
|
||||
E0515: r##"
|
||||
A constant index expression was out of bounds. Erroneous code example:
|
||||
|
||||
```
|
||||
let x = &[0, 1, 2][7]; // error: const index-expr is out of bounds
|
||||
```
|
||||
|
||||
Please specify a valid index (not inferior to 0 or superior to array length).
|
||||
Example:
|
||||
|
||||
```
|
||||
let x = &[0, 1, 2][2]; // ok!
|
||||
```
|
||||
"##,
|
||||
|
||||
}
|
||||
|
||||
register_diagnostics! {
|
||||
|
||||
Reference in New Issue
Block a user