Skip to content

Commit 6591f4f

Browse files
committed
Change suggestion message wording
1 parent f4d3952 commit 6591f4f

File tree

57 files changed

+163
-165
lines changed

Some content is hidden

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

57 files changed

+163
-165
lines changed

compiler/rustc_hir_analysis/src/errors/wrong_number_of_generic_args.rs

+3-5
Original file line numberDiff line numberDiff line change
@@ -947,8 +947,7 @@ impl<'a, 'tcx> WrongNumberOfGenericArgs<'a, 'tcx> {
947947

948948
let num_redundant_lt_args = lt_arg_spans.len() - self.num_expected_lifetime_args();
949949
let msg_lifetimes = format!(
950-
"remove {these} lifetime argument{s}",
951-
these = pluralize!("this", num_redundant_lt_args),
950+
"remove the lifetime argument{s}",
952951
s = pluralize!(num_redundant_lt_args),
953952
);
954953

@@ -989,8 +988,7 @@ impl<'a, 'tcx> WrongNumberOfGenericArgs<'a, 'tcx> {
989988
let num_redundant_gen_args =
990989
gen_arg_spans.len() - self.num_expected_type_or_const_args();
991990
let msg_types_or_consts = format!(
992-
"remove {these} generic argument{s}",
993-
these = pluralize!("this", num_redundant_gen_args),
991+
"remove the unnecessary generic argument{s}",
994992
s = pluralize!(num_redundant_gen_args),
995993
);
996994

@@ -1036,7 +1034,7 @@ impl<'a, 'tcx> WrongNumberOfGenericArgs<'a, 'tcx> {
10361034
.with_lo(self.path_segment.ident.span.hi());
10371035

10381036
let msg = format!(
1039-
"remove these {}generics",
1037+
"remove the unnecessary {}generics",
10401038
if self.gen_args.parenthesized == hir::GenericArgsParentheses::ParenSugar {
10411039
"parenthetical "
10421040
} else {

tests/rustdoc-ui/invalid_const_in_lifetime_position.stderr

+3-3
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ note: associated type defined here, with 0 generic parameters
2525
|
2626
LL | type Y<'a>;
2727
| ^
28-
help: remove these generics
28+
help: remove the unnecessary generics
2929
|
3030
LL - fn f<'a>(arg : Box<dyn X<Y<1> = &'a ()>>) {}
3131
LL + fn f<'a>(arg : Box<dyn X<Y = &'a ()>>) {}
@@ -60,7 +60,7 @@ note: associated type defined here, with 0 generic parameters
6060
LL | type Y<'a>;
6161
| ^
6262
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
63-
help: remove these generics
63+
help: remove the unnecessary generics
6464
|
6565
LL - fn f<'a>(arg : Box<dyn X<Y<1> = &'a ()>>) {}
6666
LL + fn f<'a>(arg : Box<dyn X<Y = &'a ()>>) {}
@@ -95,7 +95,7 @@ note: associated type defined here, with 0 generic parameters
9595
LL | type Y<'a>;
9696
| ^
9797
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
98-
help: remove these generics
98+
help: remove the unnecessary generics
9999
|
100100
LL - fn f<'a>(arg : Box<dyn X<Y<1> = &'a ()>>) {}
101101
LL + fn f<'a>(arg : Box<dyn X<Y = &'a ()>>) {}

tests/rustdoc-ui/mismatched_arg_count.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ note: type alias defined here, with 1 lifetime parameter: `'a`
99
|
1010
LL | type Alias<'a, T> = <T as Trait<'a>>::Assoc;
1111
| ^^^^^ --
12-
help: remove this lifetime argument
12+
help: remove the lifetime argument
1313
|
1414
LL - fn bar<'a, T: Trait<'a>>(_: Alias<'a, 'a, T>) {}
1515
LL + fn bar<'a, T: Trait<'a>>(_: Alias<'a, , T>) {}

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ note: function defined here, with 0 generic parameters
1010
LL | fn foo(i: impl std::fmt::Display) {}
1111
| ^^^
1212
= note: `impl Trait` cannot be explicitly specified as a generic argument
13-
help: remove these generics
13+
help: remove the unnecessary generics
1414
|
1515
LL - foo::<()>(());
1616
LL + foo(());

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ note: struct defined here, with 0 lifetime parameters
99
|
1010
LL | struct LockedMarket<T>(T);
1111
| ^^^^^^^^^^^^
12-
help: remove these generics
12+
help: remove the unnecessary generics
1313
|
1414
LL - async fn buy_lock(coroutine: &Mutex<MarketMultiplier>) -> LockedMarket<'_> {
1515
LL + async fn buy_lock(coroutine: &Mutex<MarketMultiplier>) -> LockedMarket {
@@ -43,7 +43,7 @@ note: struct defined here, with 0 lifetime parameters
4343
LL | struct LockedMarket<T>(T);
4444
| ^^^^^^^^^^^^
4545
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
46-
help: remove these generics
46+
help: remove the unnecessary generics
4747
|
4848
LL - async fn buy_lock(coroutine: &Mutex<MarketMultiplier>) -> LockedMarket<'_> {
4949
LL + async fn buy_lock(coroutine: &Mutex<MarketMultiplier>) -> LockedMarket {

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ error[E0107]: trait takes at most 2 generic arguments but 3 generic arguments we
44
LL | Dst: BikeshedIntrinsicFrom<Src, Context, ASSUME>,
55
| ^^^^^^^^^^^^^^^^^^^^^ expected at most 2 generic arguments
66
|
7-
help: remove this generic argument
7+
help: remove the unnecessary generic argument
88
|
99
LL - Dst: BikeshedIntrinsicFrom<Src, Context, ASSUME>,
1010
LL + Dst: BikeshedIntrinsicFrom<Src, Context, >,

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ note: struct defined here, with 2 generic parameters: `T`, `N`
3030
|
3131
LL | struct All<'a, T, const N: usize> {
3232
| ^^^ - --------------
33-
help: remove this generic argument
33+
help: remove the unnecessary generic argument
3434
|
3535
LL - let a: All<_, _, _>;
3636
LL + let a: All<_, _, >;

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ note: function defined here, with 1 generic parameter: `N`
99
|
1010
LL | fn foo<const N: usize>(
1111
| ^^^ --------------
12-
help: remove this generic argument
12+
help: remove the unnecessary generic argument
1313
|
1414
LL - foo::<_, L>([(); L + 1 + L]);
1515
LL + foo::<_, >([(); L + 1 + L]);

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

+3-3
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ note: associated type defined here, with 0 generic parameters
2525
|
2626
LL | type Y<'a>;
2727
| ^
28-
help: remove these generics
28+
help: remove the unnecessary generics
2929
|
3030
LL - fn f2<'a>(arg: Box<dyn X<Y<1> = &'a ()>>) {}
3131
LL + fn f2<'a>(arg: Box<dyn X<Y = &'a ()>>) {}
@@ -60,7 +60,7 @@ note: associated type defined here, with 0 generic parameters
6060
LL | type Y<'a>;
6161
| ^
6262
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
63-
help: remove these generics
63+
help: remove the unnecessary generics
6464
|
6565
LL - fn f2<'a>(arg: Box<dyn X<Y<1> = &'a ()>>) {}
6666
LL + fn f2<'a>(arg: Box<dyn X<Y = &'a ()>>) {}
@@ -95,7 +95,7 @@ note: associated type defined here, with 0 generic parameters
9595
LL | type Y<'a>;
9696
| ^
9797
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
98-
help: remove these generics
98+
help: remove the unnecessary generics
9999
|
100100
LL - fn f2<'a>(arg: Box<dyn X<Y<1> = &'a ()>>) {}
101101
LL + fn f2<'a>(arg: Box<dyn X<Y = &'a ()>>) {}

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ note: function defined here, with 2 generic parameters: `X`, `Y`
2727
|
2828
LL | fn foo<const X: usize, const Y: usize>() -> usize {
2929
| ^^^ -------------- --------------
30-
help: remove this generic argument
30+
help: remove the unnecessary generic argument
3131
|
3232
LL - foo::<0, 0, 0>();
3333
LL + foo::<0, 0, >();

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ help: consider moving this generic argument to the `TryInto` trait, which takes
88
|
99
LL | let _: u32 = TryInto::<32>::try_into(5i32).unwrap();
1010
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
11-
help: remove these generics
11+
help: remove the unnecessary generics
1212
|
1313
LL - let _: u32 = 5i32.try_into::<32>().unwrap();
1414
LL + let _: u32 = 5i32.try_into().unwrap();
@@ -34,7 +34,7 @@ note: struct defined here, with 0 generic parameters
3434
|
3535
LL | struct S;
3636
| ^
37-
help: remove these generics
37+
help: remove the unnecessary generics
3838
|
3939
LL - S::<0>;
4040
LL + S;

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ error[E0107]: struct takes 1 generic argument but 2 generic arguments were suppl
44
LL | let _: Cell<&str, "a"> = Cell::new("");
55
| ^^^^ expected 1 generic argument
66
|
7-
help: remove this generic argument
7+
help: remove the unnecessary generic argument
88
|
99
LL - let _: Cell<&str, "a"> = Cell::new("");
1010
LL + let _: Cell<&str, > = Cell::new("");

tests/ui/constructor-lifetime-args.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ note: struct defined here, with 2 lifetime parameters: `'a`, `'b`
2727
|
2828
LL | struct S<'a, 'b>(&'a u8, &'b u8);
2929
| ^ -- --
30-
help: remove this lifetime argument
30+
help: remove the lifetime argument
3131
|
3232
LL - S::<'static, 'static, 'static>(&0, &0);
3333
LL + S::<'static, 'static, >(&0, &0);
@@ -62,7 +62,7 @@ note: enum defined here, with 2 lifetime parameters: `'a`, `'b`
6262
|
6363
LL | enum E<'a, 'b> {
6464
| ^ -- --
65-
help: remove this lifetime argument
65+
help: remove the lifetime argument
6666
|
6767
LL - E::V::<'static, 'static, 'static>(&0);
6868
LL + E::V::<'static, 'static, >(&0);

tests/ui/consts/effect_param.stderr

+4-4
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ error[E0107]: method takes 0 generic arguments but 1 generic argument was suppli
44
LL | i8::checked_sub::<false>(42, 43);
55
| ^^^^^^^^^^^ expected 0 generic arguments
66
|
7-
help: remove these generics
7+
help: remove the unnecessary generics
88
|
99
LL - i8::checked_sub::<false>(42, 43);
1010
LL + i8::checked_sub(42, 43);
@@ -16,7 +16,7 @@ error[E0107]: method takes 0 generic arguments but 1 generic argument was suppli
1616
LL | i8::checked_sub::<true>(42, 43);
1717
| ^^^^^^^^^^^ expected 0 generic arguments
1818
|
19-
help: remove these generics
19+
help: remove the unnecessary generics
2020
|
2121
LL - i8::checked_sub::<true>(42, 43);
2222
LL + i8::checked_sub(42, 43);
@@ -28,7 +28,7 @@ error[E0107]: method takes 0 generic arguments but 1 generic argument was suppli
2828
LL | i8::checked_sub::<true>(42, 43);
2929
| ^^^^^^^^^^^ expected 0 generic arguments
3030
|
31-
help: remove these generics
31+
help: remove the unnecessary generics
3232
|
3333
LL - i8::checked_sub::<true>(42, 43);
3434
LL + i8::checked_sub(42, 43);
@@ -40,7 +40,7 @@ error[E0107]: method takes 0 generic arguments but 1 generic argument was suppli
4040
LL | i8::checked_sub::<false>(42, 43);
4141
| ^^^^^^^^^^^ expected 0 generic arguments
4242
|
43-
help: remove these generics
43+
help: remove the unnecessary generics
4444
|
4545
LL - i8::checked_sub::<false>(42, 43);
4646
LL + i8::checked_sub(42, 43);

tests/ui/error-codes/E0107.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -16,35 +16,35 @@ struct Baz<'a, 'b, 'c> {
1616

1717
bar: Bar<'a>,
1818
//~^ ERROR enum takes 0 lifetime arguments
19-
//~| HELP remove these generics
19+
//~| HELP remove the unnecessary generics
2020

2121
foo2: Foo<'a, 'b, 'c>,
2222
//~^ ERROR struct takes 1 lifetime argument
23-
//~| HELP remove these lifetime arguments
23+
//~| HELP remove the lifetime arguments
2424

2525
qux1: Qux<'a, 'b, i32>,
2626
//~^ ERROR struct takes 1 lifetime argument
27-
//~| HELP remove this lifetime argument
27+
//~| HELP remove the lifetime argument
2828

2929
qux2: Qux<'a, i32, 'b>,
3030
//~^ ERROR struct takes 1 lifetime argument
31-
//~| HELP remove this lifetime argument
31+
//~| HELP remove the lifetime argument
3232

3333
qux3: Qux<'a, 'b, 'c, i32>,
3434
//~^ ERROR struct takes 1 lifetime argument
35-
//~| HELP remove these lifetime arguments
35+
//~| HELP remove the lifetime arguments
3636

3737
qux4: Qux<'a, i32, 'b, 'c>,
3838
//~^ ERROR struct takes 1 lifetime argument
39-
//~| HELP remove these lifetime arguments
39+
//~| HELP remove the lifetime arguments
4040

4141
qux5: Qux<'a, 'b, i32, 'c>,
4242
//~^ ERROR struct takes 1 lifetime argument
43-
//~| HELP remove this lifetime argument
43+
//~| HELP remove the lifetime argument
4444

4545
quux: Quux<'a, i32, 'b>,
4646
//~^ ERROR struct takes 0 lifetime arguments
47-
//~| HELP remove this lifetime argument
47+
//~| HELP remove the lifetime argument
4848
}
4949

5050
pub trait T {

tests/ui/error-codes/E0107.stderr

+8-8
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ note: enum defined here, with 0 lifetime parameters
2727
|
2828
LL | enum Bar {
2929
| ^^^
30-
help: remove these generics
30+
help: remove the unnecessary generics
3131
|
3232
LL - bar: Bar<'a>,
3333
LL + bar: Bar,
@@ -44,7 +44,7 @@ note: struct defined here, with 1 lifetime parameter: `'a`
4444
|
4545
LL | struct Foo<'a>(&'a str);
4646
| ^^^ --
47-
help: remove these lifetime arguments
47+
help: remove the lifetime arguments
4848
|
4949
LL - foo2: Foo<'a, 'b, 'c>,
5050
LL + foo2: Foo<'a, >,
@@ -61,7 +61,7 @@ note: struct defined here, with 1 lifetime parameter: `'a`
6161
|
6262
LL | struct Qux<'a, T>(&'a T);
6363
| ^^^ --
64-
help: remove this lifetime argument
64+
help: remove the lifetime argument
6565
|
6666
LL - qux1: Qux<'a, 'b, i32>,
6767
LL + qux1: Qux<'a, , i32>,
@@ -78,7 +78,7 @@ note: struct defined here, with 1 lifetime parameter: `'a`
7878
|
7979
LL | struct Qux<'a, T>(&'a T);
8080
| ^^^ --
81-
help: remove this lifetime argument
81+
help: remove the lifetime argument
8282
|
8383
LL - qux2: Qux<'a, i32, 'b>,
8484
LL + qux2: Qux<'a, i32, >,
@@ -95,7 +95,7 @@ note: struct defined here, with 1 lifetime parameter: `'a`
9595
|
9696
LL | struct Qux<'a, T>(&'a T);
9797
| ^^^ --
98-
help: remove these lifetime arguments
98+
help: remove the lifetime arguments
9999
|
100100
LL - qux3: Qux<'a, 'b, 'c, i32>,
101101
LL + qux3: Qux<'a, , i32>,
@@ -112,7 +112,7 @@ note: struct defined here, with 1 lifetime parameter: `'a`
112112
|
113113
LL | struct Qux<'a, T>(&'a T);
114114
| ^^^ --
115-
help: remove these lifetime arguments
115+
help: remove the lifetime arguments
116116
|
117117
LL - qux4: Qux<'a, i32, 'b, 'c>,
118118
LL + qux4: Qux<'a, i32, >,
@@ -129,7 +129,7 @@ note: struct defined here, with 1 lifetime parameter: `'a`
129129
|
130130
LL | struct Qux<'a, T>(&'a T);
131131
| ^^^ --
132-
help: remove this lifetime argument
132+
help: remove the lifetime argument
133133
|
134134
LL - qux5: Qux<'a, 'b, i32, 'c>,
135135
LL + qux5: Qux<'a, , i32, 'c>,
@@ -146,7 +146,7 @@ note: struct defined here, with 0 lifetime parameters
146146
|
147147
LL | struct Quux<T>(T);
148148
| ^^^^
149-
help: remove this lifetime argument
149+
help: remove the lifetime argument
150150
|
151151
LL - quux: Quux<'a, i32, 'b>,
152152
LL + quux: Quux<, i32, 'b>,

tests/ui/generic-associated-types/gat-trait-path-parenthesised-args.stderr

+3-3
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ note: associated type defined here, with 0 generic parameters
5050
|
5151
LL | type Y<'a>;
5252
| ^
53-
help: remove these generics
53+
help: remove the unnecessary generics
5454
|
5555
LL - fn foo<'a>(arg: Box<dyn X<Y('a) = &'a ()>>) {}
5656
LL + fn foo<'a>(arg: Box<dyn X<Y = &'a ()>>) {}
@@ -85,7 +85,7 @@ note: associated type defined here, with 0 generic parameters
8585
LL | type Y<'a>;
8686
| ^
8787
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
88-
help: remove these generics
88+
help: remove the unnecessary generics
8989
|
9090
LL - fn foo<'a>(arg: Box<dyn X<Y('a) = &'a ()>>) {}
9191
LL + fn foo<'a>(arg: Box<dyn X<Y = &'a ()>>) {}
@@ -120,7 +120,7 @@ note: associated type defined here, with 0 generic parameters
120120
LL | type Y<'a>;
121121
| ^
122122
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
123-
help: remove these generics
123+
help: remove the unnecessary generics
124124
|
125125
LL - fn foo<'a>(arg: Box<dyn X<Y('a) = &'a ()>>) {}
126126
LL + fn foo<'a>(arg: Box<dyn X<Y = &'a ()>>) {}

tests/ui/generic-associated-types/parameter_number_and_kind.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ note: associated type defined here, with 1 lifetime parameter: `'a`
99
|
1010
LL | type E<'a, T>;
1111
| ^ --
12-
help: remove this lifetime argument
12+
help: remove the lifetime argument
1313
|
1414
LL - type FErr1 = Self::E<'static, 'static>;
1515
LL + type FErr1 = Self::E<'static, >;
@@ -42,7 +42,7 @@ note: associated type defined here, with 1 generic parameter: `T`
4242
|
4343
LL | type E<'a, T>;
4444
| ^ -
45-
help: remove this generic argument
45+
help: remove the unnecessary generic argument
4646
|
4747
LL - type FErr2<T> = Self::E<'static, T, u32>;
4848
LL + type FErr2<T> = Self::E<'static, T, >;

0 commit comments

Comments
 (0)