2021-09-25 13:23:07 -05:00
|
|
|
error: negative integers cannot be used to index on a `Vec<{integer}>`
|
|
|
|
--> $DIR/negative-literal-index.rs:15:7
|
|
|
|
|
|
|
|
|
LL | x[-1];
|
|
|
|
| ^^ cannot use a negative integer for indexing on `Vec<{integer}>`
|
|
|
|
|
|
2021-09-28 11:13:39 -05:00
|
|
|
help: to access an element starting from the end of the `Vec<{integer}>`, compute the index
|
2021-09-25 13:23:07 -05:00
|
|
|
|
|
|
|
|
LL | x[x.len() -1];
|
|
|
|
| +++++++
|
|
|
|
|
|
|
|
error: negative integers cannot be used to index on a `[{integer}; 3]`
|
|
|
|
--> $DIR/negative-literal-index.rs:17:7
|
|
|
|
|
|
|
|
|
LL | x[-1];
|
|
|
|
| ^^ cannot use a negative integer for indexing on `[{integer}; 3]`
|
|
|
|
|
|
2021-09-28 11:13:39 -05:00
|
|
|
help: to access an element starting from the end of the `[{integer}; 3]`, compute the index
|
2021-09-25 13:23:07 -05:00
|
|
|
|
|
|
|
|
LL | x[x.len() -1];
|
|
|
|
| +++++++
|
|
|
|
|
|
|
|
error: negative integers cannot be used to index on a `[{integer}; 3]`
|
|
|
|
--> $DIR/negative-literal-index.rs:19:7
|
|
|
|
|
|
|
|
|
LL | x[-1];
|
|
|
|
| ^^ cannot use a negative integer for indexing on `[{integer}; 3]`
|
|
|
|
|
|
2021-09-28 11:13:39 -05:00
|
|
|
help: to access an element starting from the end of the `[{integer}; 3]`, compute the index
|
2021-09-25 13:23:07 -05:00
|
|
|
|
|
|
|
|
LL | x[x.len() -1];
|
|
|
|
| +++++++
|
|
|
|
|
|
|
|
error: aborting due to 3 previous errors
|
|
|
|
|