summaryrefslogtreecommitdiffstats
path: root/tests/ui/suggestions/negative-literal-index.stderr
blob: 2b51bf7b7ce87c21a1d2bc8feb9c1cdadd0333a8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
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}>`
   |
help: to access an element starting from the end of the `Vec<{integer}>`, compute the index
   |
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]`
   |
help: to access an element starting from the end of the `[{integer}; 3]`, compute the index
   |
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]`
   |
help: to access an element starting from the end of the `[{integer}; 3]`, compute the index
   |
LL |     x[x.len() -1];
   |       +++++++

error: aborting due to 3 previous errors