Skip to content

Commit 921de9d

Browse files
committed
Revert suggestion verbosity change
1 parent b30fdec commit 921de9d

File tree

52 files changed

+402
-811
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+402
-811
lines changed

compiler/rustc_hir_analysis/src/errors/wrong_number_of_generic_args.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -954,7 +954,7 @@ impl<'a, 'tcx> WrongNumberOfGenericArgs<'a, 'tcx> {
954954
let msg_lifetimes =
955955
format!("remove the lifetime argument{s}", s = pluralize!(num_redundant_lt_args));
956956

957-
err.span_suggestion_verbose(
957+
err.span_suggestion(
958958
span_redundant_lt_args,
959959
msg_lifetimes,
960960
"",
@@ -1000,7 +1000,7 @@ impl<'a, 'tcx> WrongNumberOfGenericArgs<'a, 'tcx> {
10001000
s = pluralize!(num_redundant_gen_args),
10011001
);
10021002

1003-
err.span_suggestion_verbose(
1003+
err.span_suggestion(
10041004
span_redundant_type_or_const_args,
10051005
msg_types_or_consts,
10061006
"",
@@ -1050,7 +1050,7 @@ impl<'a, 'tcx> WrongNumberOfGenericArgs<'a, 'tcx> {
10501050
},
10511051
);
10521052

1053-
err.span_suggestion_verbose(span, msg, "", Applicability::MaybeIncorrect);
1053+
err.span_suggestion(span, msg, "", Applicability::MaybeIncorrect);
10541054
} else if redundant_lifetime_args && redundant_type_or_const_args {
10551055
remove_lifetime_args(err);
10561056
remove_type_or_const_args(err);

tests/rustdoc-ui/invalid_const_in_lifetime_position.stderr

+9-18
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,15 @@ error[E0107]: associated type takes 0 generic arguments but 1 generic argument w
1818
--> $DIR/invalid_const_in_lifetime_position.rs:4:26
1919
|
2020
LL | fn f<'a>(arg : Box<dyn X<Y<1> = &'a ()>>) {}
21-
| ^ expected 0 generic arguments
21+
| ^--- help: remove the unnecessary generics
22+
| |
23+
| expected 0 generic arguments
2224
|
2325
note: associated type defined here, with 0 generic parameters
2426
--> $DIR/invalid_const_in_lifetime_position.rs:2:10
2527
|
2628
LL | type Y<'a>;
2729
| ^
28-
help: remove the unnecessary generics
29-
|
30-
LL - fn f<'a>(arg : Box<dyn X<Y<1> = &'a ()>>) {}
31-
LL + fn f<'a>(arg : Box<dyn X<Y = &'a ()>>) {}
32-
|
3330

3431
error[E0107]: associated type takes 1 lifetime argument but 0 lifetime arguments were supplied
3532
--> $DIR/invalid_const_in_lifetime_position.rs:4:26
@@ -52,19 +49,16 @@ error[E0107]: associated type takes 0 generic arguments but 1 generic argument w
5249
--> $DIR/invalid_const_in_lifetime_position.rs:4:26
5350
|
5451
LL | fn f<'a>(arg : Box<dyn X<Y<1> = &'a ()>>) {}
55-
| ^ expected 0 generic arguments
52+
| ^--- help: remove the unnecessary generics
53+
| |
54+
| expected 0 generic arguments
5655
|
5756
note: associated type defined here, with 0 generic parameters
5857
--> $DIR/invalid_const_in_lifetime_position.rs:2:10
5958
|
6059
LL | type Y<'a>;
6160
| ^
6261
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
63-
help: remove the unnecessary generics
64-
|
65-
LL - fn f<'a>(arg : Box<dyn X<Y<1> = &'a ()>>) {}
66-
LL + fn f<'a>(arg : Box<dyn X<Y = &'a ()>>) {}
67-
|
6862

6963
error[E0107]: associated type takes 1 lifetime argument but 0 lifetime arguments were supplied
7064
--> $DIR/invalid_const_in_lifetime_position.rs:4:26
@@ -87,19 +81,16 @@ error[E0107]: associated type takes 0 generic arguments but 1 generic argument w
8781
--> $DIR/invalid_const_in_lifetime_position.rs:4:26
8882
|
8983
LL | fn f<'a>(arg : Box<dyn X<Y<1> = &'a ()>>) {}
90-
| ^ expected 0 generic arguments
84+
| ^--- help: remove the unnecessary generics
85+
| |
86+
| expected 0 generic arguments
9187
|
9288
note: associated type defined here, with 0 generic parameters
9389
--> $DIR/invalid_const_in_lifetime_position.rs:2:10
9490
|
9591
LL | type Y<'a>;
9692
| ^
9793
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
98-
help: remove the unnecessary generics
99-
|
100-
LL - fn f<'a>(arg : Box<dyn X<Y<1> = &'a ()>>) {}
101-
LL + fn f<'a>(arg : Box<dyn X<Y = &'a ()>>) {}
102-
|
10394

10495
error[E0038]: the trait `X` cannot be made into an object
10596
--> $DIR/invalid_const_in_lifetime_position.rs:4:20

tests/rustdoc-ui/mismatched_arg_count.stderr

+3-6
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,15 @@ error[E0107]: type alias takes 1 lifetime argument but 2 lifetime arguments were
22
--> $DIR/mismatched_arg_count.rs:7:29
33
|
44
LL | fn bar<'a, T: Trait<'a>>(_: Alias<'a, 'a, T>) {}
5-
| ^^^^^ expected 1 lifetime argument
5+
| ^^^^^ ---- help: remove the lifetime argument
6+
| |
7+
| expected 1 lifetime argument
68
|
79
note: type alias defined here, with 1 lifetime parameter: `'a`
810
--> $DIR/mismatched_arg_count.rs:5:6
911
|
1012
LL | type Alias<'a, T> = <T as Trait<'a>>::Assoc;
1113
| ^^^^^ --
12-
help: remove the lifetime argument
13-
|
14-
LL - fn bar<'a, T: Trait<'a>>(_: Alias<'a, 'a, T>) {}
15-
LL + fn bar<'a, T: Trait<'a>>(_: Alias<'a, T>) {}
16-
|
1714

1815
error: aborting due to 1 previous error
1916

tests/ui/argument-suggestions/issue-100154.stderr

+3-6
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,16 @@ error[E0107]: function takes 0 generic arguments but 1 generic argument was supp
22
--> $DIR/issue-100154.rs:4:5
33
|
44
LL | foo::<()>(());
5-
| ^^^ expected 0 generic arguments
5+
| ^^^------ help: remove the unnecessary generics
6+
| |
7+
| expected 0 generic arguments
68
|
79
note: function defined here, with 0 generic parameters
810
--> $DIR/issue-100154.rs:1:4
911
|
1012
LL | fn foo(i: impl std::fmt::Display) {}
1113
| ^^^
1214
= note: `impl Trait` cannot be explicitly specified as a generic argument
13-
help: remove the unnecessary generics
14-
|
15-
LL - foo::<()>(());
16-
LL + foo(());
17-
|
1815

1916
error[E0277]: `()` doesn't implement `std::fmt::Display`
2017
--> $DIR/issue-100154.rs:4:11

tests/ui/borrowck/issue-82126-mismatched-subst-and-hir.stderr

+6-12
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,15 @@ error[E0107]: struct takes 0 lifetime arguments but 1 lifetime argument was supp
22
--> $DIR/issue-82126-mismatched-subst-and-hir.rs:16:59
33
|
44
LL | async fn buy_lock(coroutine: &Mutex<MarketMultiplier>) -> LockedMarket<'_> {
5-
| ^^^^^^^^^^^^ expected 0 lifetime arguments
5+
| ^^^^^^^^^^^^---- help: remove the unnecessary generics
6+
| |
7+
| expected 0 lifetime arguments
68
|
79
note: struct defined here, with 0 lifetime parameters
810
--> $DIR/issue-82126-mismatched-subst-and-hir.rs:24:8
911
|
1012
LL | struct LockedMarket<T>(T);
1113
| ^^^^^^^^^^^^
12-
help: remove the unnecessary generics
13-
|
14-
LL - async fn buy_lock(coroutine: &Mutex<MarketMultiplier>) -> LockedMarket<'_> {
15-
LL + async fn buy_lock(coroutine: &Mutex<MarketMultiplier>) -> LockedMarket {
16-
|
1714

1815
error[E0107]: struct takes 1 generic argument but 0 generic arguments were supplied
1916
--> $DIR/issue-82126-mismatched-subst-and-hir.rs:16:59
@@ -35,19 +32,16 @@ error[E0107]: struct takes 0 lifetime arguments but 1 lifetime argument was supp
3532
--> $DIR/issue-82126-mismatched-subst-and-hir.rs:16:59
3633
|
3734
LL | async fn buy_lock(coroutine: &Mutex<MarketMultiplier>) -> LockedMarket<'_> {
38-
| ^^^^^^^^^^^^ expected 0 lifetime arguments
35+
| ^^^^^^^^^^^^---- help: remove the unnecessary generics
36+
| |
37+
| expected 0 lifetime arguments
3938
|
4039
note: struct defined here, with 0 lifetime parameters
4140
--> $DIR/issue-82126-mismatched-subst-and-hir.rs:24:8
4241
|
4342
LL | struct LockedMarket<T>(T);
4443
| ^^^^^^^^^^^^
4544
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
46-
help: remove the unnecessary generics
47-
|
48-
LL - async fn buy_lock(coroutine: &Mutex<MarketMultiplier>) -> LockedMarket<'_> {
49-
LL + async fn buy_lock(coroutine: &Mutex<MarketMultiplier>) -> LockedMarket {
50-
|
5145

5246
error[E0107]: struct takes 1 generic argument but 0 generic arguments were supplied
5347
--> $DIR/issue-82126-mismatched-subst-and-hir.rs:16:59

tests/ui/const-generics/adt_const_params/transmutable-ice-110969.stderr

+3-7
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,9 @@ error[E0107]: trait takes at most 2 generic arguments but 3 generic arguments we
22
--> $DIR/transmutable-ice-110969.rs:11:14
33
|
44
LL | Dst: BikeshedIntrinsicFrom<Src, Context, ASSUME>,
5-
| ^^^^^^^^^^^^^^^^^^^^^ expected at most 2 generic arguments
6-
|
7-
help: remove the unnecessary generic argument
8-
|
9-
LL - Dst: BikeshedIntrinsicFrom<Src, Context, ASSUME>,
10-
LL + Dst: BikeshedIntrinsicFrom<Src, Context>,
11-
|
5+
| ^^^^^^^^^^^^^^^^^^^^^ -------- help: remove the unnecessary generic argument
6+
| |
7+
| expected at most 2 generic arguments
128

139
error[E0308]: mismatched types
1410
--> $DIR/transmutable-ice-110969.rs:25:74

tests/ui/const-generics/generic_arg_infer/infer-arg-test.stderr

+3-6
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,15 @@ error[E0107]: struct takes 2 generic arguments but 3 generic arguments were supp
2323
--> $DIR/infer-arg-test.rs:18:10
2424
|
2525
LL | let a: All<_, _, _>;
26-
| ^^^ expected 2 generic arguments
26+
| ^^^ --- help: remove the unnecessary generic argument
27+
| |
28+
| expected 2 generic arguments
2729
|
2830
note: struct defined here, with 2 generic parameters: `T`, `N`
2931
--> $DIR/infer-arg-test.rs:3:8
3032
|
3133
LL | struct All<'a, T, const N: usize> {
3234
| ^^^ - --------------
33-
help: remove the unnecessary generic argument
34-
|
35-
LL - let a: All<_, _, _>;
36-
LL + let a: All<_, _>;
37-
|
3835

3936
error: aborting due to 4 previous errors
4037

tests/ui/const-generics/generic_const_exprs/const_kind_expr/issue_114151.stderr

+3-6
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,15 @@ error[E0107]: function takes 1 generic argument but 2 generic arguments were sup
22
--> $DIR/issue_114151.rs:17:5
33
|
44
LL | foo::<_, L>([(); L + 1 + L]);
5-
| ^^^ expected 1 generic argument
5+
| ^^^ --- help: remove the unnecessary generic argument
6+
| |
7+
| expected 1 generic argument
68
|
79
note: function defined here, with 1 generic parameter: `N`
810
--> $DIR/issue_114151.rs:4:4
911
|
1012
LL | fn foo<const N: usize>(
1113
| ^^^ --------------
12-
help: remove the unnecessary generic argument
13-
|
14-
LL - foo::<_, L>([(); L + 1 + L]);
15-
LL + foo::<_>([(); L + 1 + L]);
16-
|
1714

1815
error[E0308]: mismatched types
1916
--> $DIR/issue_114151.rs:17:18

tests/ui/const-generics/generic_const_exprs/issue-102768.stderr

+9-18
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,15 @@ error[E0107]: associated type takes 0 generic arguments but 1 generic argument w
1818
--> $DIR/issue-102768.rs:9:30
1919
|
2020
LL | fn f2<'a>(arg: Box<dyn X<Y<1> = &'a ()>>) {}
21-
| ^ expected 0 generic arguments
21+
| ^--- help: remove the unnecessary generics
22+
| |
23+
| expected 0 generic arguments
2224
|
2325
note: associated type defined here, with 0 generic parameters
2426
--> $DIR/issue-102768.rs:5:10
2527
|
2628
LL | type Y<'a>;
2729
| ^
28-
help: remove the unnecessary generics
29-
|
30-
LL - fn f2<'a>(arg: Box<dyn X<Y<1> = &'a ()>>) {}
31-
LL + fn f2<'a>(arg: Box<dyn X<Y = &'a ()>>) {}
32-
|
3330

3431
error[E0107]: associated type takes 1 lifetime argument but 0 lifetime arguments were supplied
3532
--> $DIR/issue-102768.rs:9:30
@@ -52,19 +49,16 @@ error[E0107]: associated type takes 0 generic arguments but 1 generic argument w
5249
--> $DIR/issue-102768.rs:9:30
5350
|
5451
LL | fn f2<'a>(arg: Box<dyn X<Y<1> = &'a ()>>) {}
55-
| ^ expected 0 generic arguments
52+
| ^--- help: remove the unnecessary generics
53+
| |
54+
| expected 0 generic arguments
5655
|
5756
note: associated type defined here, with 0 generic parameters
5857
--> $DIR/issue-102768.rs:5:10
5958
|
6059
LL | type Y<'a>;
6160
| ^
6261
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
63-
help: remove the unnecessary generics
64-
|
65-
LL - fn f2<'a>(arg: Box<dyn X<Y<1> = &'a ()>>) {}
66-
LL + fn f2<'a>(arg: Box<dyn X<Y = &'a ()>>) {}
67-
|
6862

6963
error[E0107]: associated type takes 1 lifetime argument but 0 lifetime arguments were supplied
7064
--> $DIR/issue-102768.rs:9:30
@@ -87,19 +81,16 @@ error[E0107]: associated type takes 0 generic arguments but 1 generic argument w
8781
--> $DIR/issue-102768.rs:9:30
8882
|
8983
LL | fn f2<'a>(arg: Box<dyn X<Y<1> = &'a ()>>) {}
90-
| ^ expected 0 generic arguments
84+
| ^--- help: remove the unnecessary generics
85+
| |
86+
| expected 0 generic arguments
9187
|
9288
note: associated type defined here, with 0 generic parameters
9389
--> $DIR/issue-102768.rs:5:10
9490
|
9591
LL | type Y<'a>;
9692
| ^
9793
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
98-
help: remove the unnecessary generics
99-
|
100-
LL - fn f2<'a>(arg: Box<dyn X<Y<1> = &'a ()>>) {}
101-
LL + fn f2<'a>(arg: Box<dyn X<Y = &'a ()>>) {}
102-
|
10394

10495
error[E0038]: the trait `X` cannot be made into an object
10596
--> $DIR/issue-102768.rs:9:24

tests/ui/const-generics/incorrect-number-of-const-args.stderr

+3-6
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,15 @@ error[E0107]: function takes 2 generic arguments but 3 generic arguments were su
2020
--> $DIR/incorrect-number-of-const-args.rs:9:5
2121
|
2222
LL | foo::<0, 0, 0>();
23-
| ^^^ expected 2 generic arguments
23+
| ^^^ --- help: remove the unnecessary generic argument
24+
| |
25+
| expected 2 generic arguments
2426
|
2527
note: function defined here, with 2 generic parameters: `X`, `Y`
2628
--> $DIR/incorrect-number-of-const-args.rs:1:4
2729
|
2830
LL | fn foo<const X: usize, const Y: usize>() -> usize {
2931
| ^^^ -------------- --------------
30-
help: remove the unnecessary generic argument
31-
|
32-
LL - foo::<0, 0, 0>();
33-
LL + foo::<0, 0>();
34-
|
3532

3633
error: aborting due to 2 previous errors
3734

tests/ui/const-generics/invalid-const-arg-for-type-param.stderr

+3-6
Original file line numberDiff line numberDiff line change
@@ -27,18 +27,15 @@ error[E0107]: struct takes 0 generic arguments but 1 generic argument was suppli
2727
--> $DIR/invalid-const-arg-for-type-param.rs:12:5
2828
|
2929
LL | S::<0>;
30-
| ^ expected 0 generic arguments
30+
| ^----- help: remove the unnecessary generics
31+
| |
32+
| expected 0 generic arguments
3133
|
3234
note: struct defined here, with 0 generic parameters
3335
--> $DIR/invalid-const-arg-for-type-param.rs:3:8
3436
|
3537
LL | struct S;
3638
| ^
37-
help: remove the unnecessary generics
38-
|
39-
LL - S::<0>;
40-
LL + S;
41-
|
4239

4340
error: aborting due to 3 previous errors
4441

tests/ui/const-generics/invalid-constant-in-args.stderr

+3-7
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,9 @@ error[E0107]: struct takes 1 generic argument but 2 generic arguments were suppl
22
--> $DIR/invalid-constant-in-args.rs:4:12
33
|
44
LL | let _: Cell<&str, "a"> = Cell::new("");
5-
| ^^^^ expected 1 generic argument
6-
|
7-
help: remove the unnecessary generic argument
8-
|
9-
LL - let _: Cell<&str, "a"> = Cell::new("");
10-
LL + let _: Cell<&str> = Cell::new("");
11-
|
5+
| ^^^^ ----- help: remove the unnecessary generic argument
6+
| |
7+
| expected 1 generic argument
128

139
error: aborting due to 1 previous error
1410

0 commit comments

Comments
 (0)