fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

master
3.1 KiB107 linesraw
1error: indexing may panic
2  --> $DIR/indexing_slicing_index.rs:14:20
3   |
4LL | 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`
10   = help: to override `-D warnings` add `#[allow(clippy::indexing_slicing)]`
11
12error: indexing may panic
13  --> $DIR/indexing_slicing_index.rs:16:24
14   |
15LL | 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
21error[E0080]: evaluation of `main::{constant#3}` failed
22  --> $DIR/indexing_slicing_index.rs:48:14
23   |
24LL |     const { &ARR[idx4()] };
25   |              ^^^^^^^^^^^ index out of bounds: the length is 2 but the index is 4
26
27note: erroneous constant encountered
28  --> $DIR/indexing_slicing_index.rs:48:5
29   |
30LL |     const { &ARR[idx4()] };
31   |     ^^^^^^^^^^^^^^^^^^^^^^
32
33error: indexing may panic
34  --> $DIR/indexing_slicing_index.rs:29:5
35   |
36LL |     x[index];
37   |     ^^^^^^^^
38   |
39   = help: consider using `.get(n)` or `.get_mut(n)` instead
40
41error: indexing may panic
42  --> $DIR/indexing_slicing_index.rs:45:14
43   |
44LL |     const { &ARR[idx()] };
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
50error: indexing may panic
51  --> $DIR/indexing_slicing_index.rs:48:14
52   |
53LL |     const { &ARR[idx4()] };
54   |              ^^^^^^^^^^^
55   |
56   = help: consider using `.get(n)` or `.get_mut(n)` instead
57   = note: the suggestion might not be applicable in constant blocks
58
59error: indexing may panic
60  --> $DIR/indexing_slicing_index.rs:58:5
61   |
62LL |     v[0];
63   |     ^^^^
64   |
65   = help: consider using `.get(n)` or `.get_mut(n)` instead
66
67error: indexing may panic
68  --> $DIR/indexing_slicing_index.rs:60:5
69   |
70LL |     v[10];
71   |     ^^^^^
72   |
73   = help: consider using `.get(n)` or `.get_mut(n)` instead
74
75error: indexing may panic
76  --> $DIR/indexing_slicing_index.rs:62:5
77   |
78LL |     v[1 << 3];
79   |     ^^^^^^^^^
80   |
81   = help: consider using `.get(n)` or `.get_mut(n)` instead
82
83error: indexing may panic
84  --> $DIR/indexing_slicing_index.rs:73:5
85   |
86LL |     v[N];
87   |     ^^^^
88   |
89   = help: consider using `.get(n)` or `.get_mut(n)` instead
90
91error: indexing may panic
92  --> $DIR/indexing_slicing_index.rs:75:5
93   |
94LL |     v[M];
95   |     ^^^^
96   |
97   = help: consider using `.get(n)` or `.get_mut(n)` instead
98
99error[E0080]: evaluation of constant value failed
100  --> $DIR/indexing_slicing_index.rs:16:24
101   |
102LL | 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
105error: aborting due to 12 previous errors
106
107For more information about this error, try `rustc --explain E0080`.