Skip to content

Commit 12e609b

Browse files
committed
use span_suggestion instead of span_suggestion_verbose
1 parent 4d1b5f0 commit 12e609b

File tree

3 files changed

+6
-22
lines changed

3 files changed

+6
-22
lines changed

compiler/rustc_typeck/src/check/expr.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1328,9 +1328,9 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
13281328
{
13291329
match self.tcx.sess.diagnostic().steal_diagnostic(span, StashKey::UnderscoreForArrayLengths) {
13301330
Some(mut err) => {
1331-
err.span_suggestion_verbose(
1331+
err.span_suggestion(
13321332
span,
1333-
"consider adding an array length",
1333+
"consider specifying the array length",
13341334
array_len,
13351335
Applicability::MaybeIncorrect,
13361336
);

src/test/ui/array-slice-vec/suggest-array-length.stderr

+3-15
Original file line numberDiff line numberDiff line change
@@ -20,40 +20,28 @@ error[E0658]: using `_` for array lengths is unstable
2020
--> $DIR/suggest-array-length.rs:5:22
2121
|
2222
LL | const Foo: [i32; _] = [1, 2, 3];
23-
| ^
23+
| ^ help: consider specifying the array length: `3`
2424
|
2525
= note: see issue #85077 <https://github.com/rust-lang/rust/issues/85077> for more information
2626
= help: add `#![feature(generic_arg_infer)]` to the crate attributes to enable
27-
help: consider adding an array length
28-
|
29-
LL | const Foo: [i32; 3] = [1, 2, 3];
30-
| ~
3127

3228
error[E0658]: using `_` for array lengths is unstable
3329
--> $DIR/suggest-array-length.rs:8:20
3430
|
3531
LL | let foo: [i32; _] = [1, 2, 3];
36-
| ^
32+
| ^ help: consider specifying the array length: `3`
3733
|
3834
= note: see issue #85077 <https://github.com/rust-lang/rust/issues/85077> for more information
3935
= help: add `#![feature(generic_arg_infer)]` to the crate attributes to enable
40-
help: consider adding an array length
41-
|
42-
LL | let foo: [i32; 3] = [1, 2, 3];
43-
| ~
4436

4537
error[E0658]: using `_` for array lengths is unstable
4638
--> $DIR/suggest-array-length.rs:11:20
4739
|
4840
LL | let bar: [i32; _] = [0; 3];
49-
| ^
41+
| ^ help: consider specifying the array length: `3`
5042
|
5143
= note: see issue #85077 <https://github.com/rust-lang/rust/issues/85077> for more information
5244
= help: add `#![feature(generic_arg_infer)]` to the crate attributes to enable
53-
help: consider adding an array length
54-
|
55-
LL | let bar: [i32; 3] = [0; 3];
56-
| ~
5745

5846
error: aborting due to 6 previous errors
5947

src/test/ui/feature-gates/feature-gate-generic_arg_infer.normal.stderr

+1-5
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,10 @@ error[E0658]: using `_` for array lengths is unstable
1414
--> $DIR/feature-gate-generic_arg_infer.rs:14:18
1515
|
1616
LL | let _y: [u8; _] = [0; 3];
17-
| ^
17+
| ^ help: consider specifying the array length: `3`
1818
|
1919
= note: see issue #85077 <https://github.com/rust-lang/rust/issues/85077> for more information
2020
= help: add `#![feature(generic_arg_infer)]` to the crate attributes to enable
21-
help: consider adding an array length
22-
|
23-
LL | let _y: [u8; 3] = [0; 3];
24-
| ~
2521

2622
error[E0747]: type provided when a constant was expected
2723
--> $DIR/feature-gate-generic_arg_infer.rs:20:20

0 commit comments

Comments
 (0)