11error: indexing may panic
22 --> $DIR/indexing_slicing_index.rs:9:20
33 |
4- LL | const REF: &i32 = &ARR[idx()]; // Ok, should not produce stderr .
4+ LL | const REF: &i32 = &ARR[idx()]; // This should be linted, since `suppress-restriction-lint-in-const` default is false .
55 | ^^^^^^^^^^
66 |
77 = help: consider using `.get(n)` or `.get_mut(n)` instead
@@ -20,13 +20,13 @@ LL | const REF_ERR: &i32 = &ARR[idx4()]; // Ok, let rustc handle const contexts.
2020error[E0080]: evaluation of `main::{constant#3}` failed
2121 --> $DIR/indexing_slicing_index.rs:31:14
2222 |
23- LL | const { &ARR[idx4()] }; // Ok, let rustc handle const contexts .
23+ LL | const { &ARR[idx4()] }; // This should be linted, since `suppress-restriction-lint-in- const` default is false .
2424 | ^^^^^^^^^^^ index out of bounds: the length is 2 but the index is 4
2525
2626note: erroneous constant used
2727 --> $DIR/indexing_slicing_index.rs:31:5
2828 |
29- LL | const { &ARR[idx4()] }; // Ok, let rustc handle const contexts .
29+ LL | const { &ARR[idx4()] }; // This should be linted, since `suppress-restriction-lint-in- const` default is false .
3030 | ^^^^^^^^^^^^^^^^^^^^^^
3131
3232error: indexing may panic
@@ -37,26 +37,10 @@ LL | x[index];
3737 |
3838 = help: consider using `.get(n)` or `.get_mut(n)` instead
3939
40- error: indexing may panic
41- --> $DIR/indexing_slicing_index.rs:28:5
42- |
43- LL | x[const { idx() }]; // Ok, should not produce stderr.
44- | ^^^^^^^^^^^^^^^^^^
45- |
46- = help: consider using `.get(n)` or `.get_mut(n)` instead
47-
48- error: indexing may panic
49- --> $DIR/indexing_slicing_index.rs:29:5
50- |
51- LL | x[const { idx4() }]; // Ok, let rustc's `unconditional_panic` lint handle `usize` indexing on arrays.
52- | ^^^^^^^^^^^^^^^^^^^
53- |
54- = help: consider using `.get(n)` or `.get_mut(n)` instead
55-
5640error: indexing may panic
5741 --> $DIR/indexing_slicing_index.rs:30:14
5842 |
59- LL | const { &ARR[idx()] }; // Ok, should not produce stderr .
43+ LL | const { &ARR[idx()] }; // This should be linted, since `suppress-restriction-lint-in-const` default is false .
6044 | ^^^^^^^^^^
6145 |
6246 = help: consider using `.get(n)` or `.get_mut(n)` instead
@@ -65,7 +49,7 @@ LL | const { &ARR[idx()] }; // Ok, should not produce stderr.
6549error: indexing may panic
6650 --> $DIR/indexing_slicing_index.rs:31:14
6751 |
68- LL | const { &ARR[idx4()] }; // Ok, let rustc handle const contexts .
52+ LL | const { &ARR[idx4()] }; // This should be linted, since `suppress-restriction-lint-in- const` default is false .
6953 | ^^^^^^^^^^^
7054 |
7155 = help: consider using `.get(n)` or `.get_mut(n)` instead
@@ -117,6 +101,6 @@ error[E0080]: evaluation of constant value failed
117101LL | const REF_ERR: &i32 = &ARR[idx4()]; // Ok, let rustc handle const contexts.
118102 | ^^^^^^^^^^^ index out of bounds: the length is 2 but the index is 4
119103
120- error: aborting due to 14 previous errors
104+ error: aborting due to 12 previous errors
121105
122106For more information about this error, try `rustc --explain E0080`.
0 commit comments