Skip to content

Commit d01f15e

Browse files
committed
fix test
1 parent da01e6b commit d01f15e

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

tests/ui/indexing_slicing_index.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#![allow(unconditional_panic, clippy::no_effect, clippy::unnecessary_operation)]
77

88
const ARR: [i32; 2] = [1, 2];
9-
const REF: &i32 = &ARR[idx()]; // This is should be linted, since `suppress-restriction-lint-in-const` default is false.
9+
const REF: &i32 = &ARR[idx()]; // This should be linted, since `suppress-restriction-lint-in-const` default is false.
1010
const REF_ERR: &i32 = &ARR[idx4()]; // Ok, let rustc handle const contexts.
1111

1212
const fn idx() -> usize {
@@ -27,8 +27,8 @@ fn main() {
2727
x[3]; // Ok, should not produce stderr.
2828
x[const { idx() }]; // Ok, should not produce stderr.
2929
x[const { idx4() }]; // Ok, let rustc's `unconditional_panic` lint handle `usize` indexing on arrays.
30-
const { &ARR[idx()] }; // This is should be linted, since `suppress-restriction-lint-in-const` default is false.
31-
const { &ARR[idx4()] }; // This is should be linted, since `suppress-restriction-lint-in-const` default is false.
30+
const { &ARR[idx()] }; // This should be linted, since `suppress-restriction-lint-in-const` default is false.
31+
const { &ARR[idx4()] }; // This should be linted, since `suppress-restriction-lint-in-const` default is false.
3232

3333
let y = &x;
3434
y[0]; // Ok, referencing shouldn't affect this lint. See the issue 6021

tests/ui/indexing_slicing_index.stderr

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
error: indexing may panic
22
--> $DIR/indexing_slicing_index.rs:9:20
33
|
4-
LL | const REF: &i32 = &ARR[idx()]; // This is should be linted, since `suppress-restriction-lint-in-const` default is false.
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.
2020
error[E0080]: evaluation of `main::{constant#3}` failed
2121
--> $DIR/indexing_slicing_index.rs:31:14
2222
|
23-
LL | const { &ARR[idx4()] }; // This is should be linted, since `suppress-restriction-lint-in-const` default is false.
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

2626
note: erroneous constant used
2727
--> $DIR/indexing_slicing_index.rs:31:5
2828
|
29-
LL | const { &ARR[idx4()] }; // This is should be linted, since `suppress-restriction-lint-in-const` default is false.
29+
LL | const { &ARR[idx4()] }; // This should be linted, since `suppress-restriction-lint-in-const` default is false.
3030
| ^^^^^^^^^^^^^^^^^^^^^^
3131

3232
error: indexing may panic
@@ -56,7 +56,7 @@ LL | x[const { idx4() }]; // Ok, let rustc's `unconditional_panic` lint hand
5656
error: indexing may panic
5757
--> $DIR/indexing_slicing_index.rs:30:14
5858
|
59-
LL | const { &ARR[idx()] }; // This is should be linted, since `suppress-restriction-lint-in-const` default is false.
59+
LL | const { &ARR[idx()] }; // This should be linted, since `suppress-restriction-lint-in-const` default is false.
6060
| ^^^^^^^^^^
6161
|
6262
= help: consider using `.get(n)` or `.get_mut(n)` instead
@@ -65,7 +65,7 @@ LL | const { &ARR[idx()] }; // This is should be linted, since `suppress-res
6565
error: indexing may panic
6666
--> $DIR/indexing_slicing_index.rs:31:14
6767
|
68-
LL | const { &ARR[idx4()] }; // This is should be linted, since `suppress-restriction-lint-in-const` default is false.
68+
LL | const { &ARR[idx4()] }; // This should be linted, since `suppress-restriction-lint-in-const` default is false.
6969
| ^^^^^^^^^^^
7070
|
7171
= help: consider using `.get(n)` or `.get_mut(n)` instead

0 commit comments

Comments
 (0)