]>
Commit | Line | Data |
---|---|---|
9c376795 | 1 | error: indexing may panic |
fe692bf9 | 2 | --> $DIR/indexing_slicing_index.rs:14:20 |
9c376795 FG |
3 | | |
4 | LL | const REF: &i32 = &ARR[idx()]; // This should be linted, since `suppress-restriction-lint-in-const` default is false. | |
5 | | ^^^^^^^^^^ | |
6 | | | |
7 | = help: consider using `.get(n)` or `.get_mut(n)` instead | |
8 | = note: the suggestion might not be applicable in constant blocks | |
9 | = note: `-D clippy::indexing-slicing` implied by `-D warnings` | |
781aab86 | 10 | = help: to override `-D warnings` add `#[allow(clippy::indexing_slicing)]` |
9c376795 FG |
11 | |
12 | error: indexing may panic | |
781aab86 | 13 | --> $DIR/indexing_slicing_index.rs:16:24 |
9c376795 FG |
14 | | |
15 | LL | const REF_ERR: &i32 = &ARR[idx4()]; // Ok, let rustc handle const contexts. | |
16 | | ^^^^^^^^^^^ | |
17 | | | |
18 | = help: consider using `.get(n)` or `.get_mut(n)` instead | |
19 | = note: the suggestion might not be applicable in constant blocks | |
20 | ||
04454e1e | 21 | error[E0080]: evaluation of `main::{constant#3}` failed |
781aab86 | 22 | --> $DIR/indexing_slicing_index.rs:48:14 |
04454e1e | 23 | | |
781aab86 | 24 | LL | const { &ARR[idx4()] }; |
04454e1e FG |
25 | | ^^^^^^^^^^^ index out of bounds: the length is 2 but the index is 4 |
26 | ||
781aab86 FG |
27 | note: erroneous constant encountered |
28 | --> $DIR/indexing_slicing_index.rs:48:5 | |
04454e1e | 29 | | |
781aab86 | 30 | LL | const { &ARR[idx4()] }; |
487cf647 | 31 | | ^^^^^^^^^^^^^^^^^^^^^^ |
04454e1e | 32 | |
f20569fa | 33 | error: indexing may panic |
781aab86 | 34 | --> $DIR/indexing_slicing_index.rs:29:5 |
f20569fa XL |
35 | | |
36 | LL | x[index]; | |
37 | | ^^^^^^^^ | |
38 | | | |
f20569fa | 39 | = help: consider using `.get(n)` or `.get_mut(n)` instead |
9c376795 FG |
40 | |
41 | error: indexing may panic | |
781aab86 | 42 | --> $DIR/indexing_slicing_index.rs:45:14 |
9c376795 | 43 | | |
781aab86 | 44 | LL | const { &ARR[idx()] }; |
9c376795 FG |
45 | | ^^^^^^^^^^ |
46 | | | |
47 | = help: consider using `.get(n)` or `.get_mut(n)` instead | |
48 | = note: the suggestion might not be applicable in constant blocks | |
49 | ||
50 | error: indexing may panic | |
781aab86 | 51 | --> $DIR/indexing_slicing_index.rs:48:14 |
9c376795 | 52 | | |
781aab86 | 53 | LL | const { &ARR[idx4()] }; |
9c376795 FG |
54 | | ^^^^^^^^^^^ |
55 | | | |
56 | = help: consider using `.get(n)` or `.get_mut(n)` instead | |
57 | = note: the suggestion might not be applicable in constant blocks | |
f20569fa XL |
58 | |
59 | error: indexing may panic | |
781aab86 | 60 | --> $DIR/indexing_slicing_index.rs:58:5 |
f20569fa XL |
61 | | |
62 | LL | v[0]; | |
63 | | ^^^^ | |
64 | | | |
65 | = help: consider using `.get(n)` or `.get_mut(n)` instead | |
66 | ||
67 | error: indexing may panic | |
781aab86 | 68 | --> $DIR/indexing_slicing_index.rs:60:5 |
f20569fa XL |
69 | | |
70 | LL | v[10]; | |
71 | | ^^^^^ | |
72 | | | |
73 | = help: consider using `.get(n)` or `.get_mut(n)` instead | |
74 | ||
75 | error: indexing may panic | |
781aab86 | 76 | --> $DIR/indexing_slicing_index.rs:62:5 |
f20569fa XL |
77 | | |
78 | LL | v[1 << 3]; | |
79 | | ^^^^^^^^^ | |
80 | | | |
81 | = help: consider using `.get(n)` or `.get_mut(n)` instead | |
82 | ||
83 | error: indexing may panic | |
781aab86 | 84 | --> $DIR/indexing_slicing_index.rs:73:5 |
f20569fa XL |
85 | | |
86 | LL | v[N]; | |
87 | | ^^^^ | |
88 | | | |
89 | = help: consider using `.get(n)` or `.get_mut(n)` instead | |
90 | ||
91 | error: indexing may panic | |
781aab86 | 92 | --> $DIR/indexing_slicing_index.rs:75:5 |
f20569fa XL |
93 | | |
94 | LL | v[M]; | |
95 | | ^^^^ | |
96 | | | |
97 | = help: consider using `.get(n)` or `.get_mut(n)` instead | |
98 | ||
2b03887a | 99 | error[E0080]: evaluation of constant value failed |
781aab86 | 100 | --> $DIR/indexing_slicing_index.rs:16:24 |
2b03887a FG |
101 | | |
102 | LL | const REF_ERR: &i32 = &ARR[idx4()]; // Ok, let rustc handle const contexts. | |
103 | | ^^^^^^^^^^^ index out of bounds: the length is 2 but the index is 4 | |
104 | ||
9c376795 | 105 | error: aborting due to 12 previous errors |
f20569fa | 106 | |
04454e1e | 107 | For more information about this error, try `rustc --explain E0080`. |