Rollup merge of #127374 - estebank:wrong-generic-args, r=oli-obk

Tweak "wrong # of generics" suggestions

Fix incorrect suggestion, make verbose and change message to make more sense when it isn't a span label.
This commit is contained in:
Matthias Krüger 2024-07-24 18:00:37 +02:00 committed by GitHub
commit 91c03ef069
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
57 changed files with 184 additions and 176 deletions

View File

@ -888,7 +888,7 @@ impl<'a, 'tcx> WrongNumberOfGenericArgs<'a, 'tcx> {
let comma = if args.len() > 0 { ", " } else { "" };
let trait_path = self.tcx.def_path_str(trait_def_id);
let method_name = self.tcx.item_name(self.def_id);
err.span_suggestion(
err.span_suggestion_verbose(
expr.span,
msg,
format!("{trait_path}::{generics}::{method_name}({rcvr}{comma}{rest})"),
@ -939,18 +939,20 @@ impl<'a, 'tcx> WrongNumberOfGenericArgs<'a, 'tcx> {
}
}
let span_lo_redundant_lt_args = lt_arg_spans[self.num_expected_lifetime_args()];
let span_lo_redundant_lt_args = if self.num_expected_lifetime_args() == 0 {
lt_arg_spans[0]
} else {
lt_arg_spans[self.num_expected_lifetime_args() - 1]
};
let span_hi_redundant_lt_args = lt_arg_spans[lt_arg_spans.len() - 1];
let span_redundant_lt_args = span_lo_redundant_lt_args.to(span_hi_redundant_lt_args);
let span_redundant_lt_args =
span_lo_redundant_lt_args.shrink_to_hi().to(span_hi_redundant_lt_args);
debug!("span_redundant_lt_args: {:?}", span_redundant_lt_args);
let num_redundant_lt_args = lt_arg_spans.len() - self.num_expected_lifetime_args();
let msg_lifetimes = format!(
"remove {these} lifetime argument{s}",
these = pluralize!("this", num_redundant_lt_args),
s = pluralize!(num_redundant_lt_args),
);
let msg_lifetimes =
format!("remove the lifetime argument{s}", s = pluralize!(num_redundant_lt_args));
err.span_suggestion(
span_redundant_lt_args,
@ -979,18 +981,22 @@ impl<'a, 'tcx> WrongNumberOfGenericArgs<'a, 'tcx> {
}
let span_lo_redundant_type_or_const_args =
gen_arg_spans[self.num_expected_type_or_const_args()];
if self.num_expected_type_or_const_args() == 0 {
gen_arg_spans[0]
} else {
gen_arg_spans[self.num_expected_type_or_const_args() - 1]
};
let span_hi_redundant_type_or_const_args = gen_arg_spans[gen_arg_spans.len() - 1];
let span_redundant_type_or_const_args = span_lo_redundant_type_or_const_args
.shrink_to_hi()
.to(span_hi_redundant_type_or_const_args);
let span_redundant_type_or_const_args =
span_lo_redundant_type_or_const_args.to(span_hi_redundant_type_or_const_args);
debug!("span_redundant_type_or_const_args: {:?}", span_redundant_type_or_const_args);
let num_redundant_gen_args =
gen_arg_spans.len() - self.num_expected_type_or_const_args();
let msg_types_or_consts = format!(
"remove {these} generic argument{s}",
these = pluralize!("this", num_redundant_gen_args),
"remove the unnecessary generic argument{s}",
s = pluralize!(num_redundant_gen_args),
);
@ -1036,7 +1042,7 @@ impl<'a, 'tcx> WrongNumberOfGenericArgs<'a, 'tcx> {
.with_lo(self.path_segment.ident.span.hi());
let msg = format!(
"remove these {}generics",
"remove the unnecessary {}generics",
if self.gen_args.parenthesized == hir::GenericArgsParentheses::ParenSugar {
"parenthetical "
} else {

View File

@ -18,7 +18,7 @@ error[E0107]: associated type takes 0 generic arguments but 1 generic argument w
--> $DIR/invalid_const_in_lifetime_position.rs:4:26
|
LL | fn f<'a>(arg : Box<dyn X<Y<1> = &'a ()>>) {}
| ^--- help: remove these generics
| ^--- help: remove the unnecessary generics
| |
| expected 0 generic arguments
|
@ -49,7 +49,7 @@ error[E0107]: associated type takes 0 generic arguments but 1 generic argument w
--> $DIR/invalid_const_in_lifetime_position.rs:4:26
|
LL | fn f<'a>(arg : Box<dyn X<Y<1> = &'a ()>>) {}
| ^--- help: remove these generics
| ^--- help: remove the unnecessary generics
| |
| expected 0 generic arguments
|
@ -81,7 +81,7 @@ error[E0107]: associated type takes 0 generic arguments but 1 generic argument w
--> $DIR/invalid_const_in_lifetime_position.rs:4:26
|
LL | fn f<'a>(arg : Box<dyn X<Y<1> = &'a ()>>) {}
| ^--- help: remove these generics
| ^--- help: remove the unnecessary generics
| |
| expected 0 generic arguments
|

View File

@ -2,7 +2,7 @@ error[E0107]: type alias takes 1 lifetime argument but 2 lifetime arguments were
--> $DIR/mismatched_arg_count.rs:7:29
|
LL | fn bar<'a, T: Trait<'a>>(_: Alias<'a, 'a, T>) {}
| ^^^^^ -- help: remove this lifetime argument
| ^^^^^ ---- help: remove the lifetime argument
| |
| expected 1 lifetime argument
|

View File

@ -2,7 +2,7 @@ error[E0107]: function takes 0 generic arguments but 1 generic argument was supp
--> $DIR/issue-100154.rs:4:5
|
LL | foo::<()>(());
| ^^^------ help: remove these generics
| ^^^------ help: remove the unnecessary generics
| |
| expected 0 generic arguments
|

View File

@ -2,7 +2,7 @@ error[E0107]: struct takes 0 lifetime arguments but 1 lifetime argument was supp
--> $DIR/issue-82126-mismatched-subst-and-hir.rs:16:59
|
LL | async fn buy_lock(coroutine: &Mutex<MarketMultiplier>) -> LockedMarket<'_> {
| ^^^^^^^^^^^^---- help: remove these generics
| ^^^^^^^^^^^^---- help: remove the unnecessary generics
| |
| expected 0 lifetime arguments
|
@ -32,7 +32,7 @@ error[E0107]: struct takes 0 lifetime arguments but 1 lifetime argument was supp
--> $DIR/issue-82126-mismatched-subst-and-hir.rs:16:59
|
LL | async fn buy_lock(coroutine: &Mutex<MarketMultiplier>) -> LockedMarket<'_> {
| ^^^^^^^^^^^^---- help: remove these generics
| ^^^^^^^^^^^^---- help: remove the unnecessary generics
| |
| expected 0 lifetime arguments
|

View File

@ -2,7 +2,7 @@ error[E0107]: trait takes at most 2 generic arguments but 3 generic arguments we
--> $DIR/transmutable-ice-110969.rs:11:14
|
LL | Dst: BikeshedIntrinsicFrom<Src, Context, ASSUME>,
| ^^^^^^^^^^^^^^^^^^^^^ ------ help: remove this generic argument
| ^^^^^^^^^^^^^^^^^^^^^ -------- help: remove the unnecessary generic argument
| |
| expected at most 2 generic arguments

View File

@ -23,7 +23,7 @@ error[E0107]: struct takes 2 generic arguments but 3 generic arguments were supp
--> $DIR/infer-arg-test.rs:18:10
|
LL | let a: All<_, _, _>;
| ^^^ - help: remove this generic argument
| ^^^ --- help: remove the unnecessary generic argument
| |
| expected 2 generic arguments
|

View File

@ -2,7 +2,7 @@ error[E0107]: function takes 1 generic argument but 2 generic arguments were sup
--> $DIR/issue_114151.rs:17:5
|
LL | foo::<_, L>([(); L + 1 + L]);
| ^^^ - help: remove this generic argument
| ^^^ --- help: remove the unnecessary generic argument
| |
| expected 1 generic argument
|

View File

@ -18,7 +18,7 @@ error[E0107]: associated type takes 0 generic arguments but 1 generic argument w
--> $DIR/issue-102768.rs:9:30
|
LL | fn f2<'a>(arg: Box<dyn X<Y<1> = &'a ()>>) {}
| ^--- help: remove these generics
| ^--- help: remove the unnecessary generics
| |
| expected 0 generic arguments
|
@ -49,7 +49,7 @@ error[E0107]: associated type takes 0 generic arguments but 1 generic argument w
--> $DIR/issue-102768.rs:9:30
|
LL | fn f2<'a>(arg: Box<dyn X<Y<1> = &'a ()>>) {}
| ^--- help: remove these generics
| ^--- help: remove the unnecessary generics
| |
| expected 0 generic arguments
|
@ -81,7 +81,7 @@ error[E0107]: associated type takes 0 generic arguments but 1 generic argument w
--> $DIR/issue-102768.rs:9:30
|
LL | fn f2<'a>(arg: Box<dyn X<Y<1> = &'a ()>>) {}
| ^--- help: remove these generics
| ^--- help: remove the unnecessary generics
| |
| expected 0 generic arguments
|

View File

@ -20,7 +20,7 @@ error[E0107]: function takes 2 generic arguments but 3 generic arguments were su
--> $DIR/incorrect-number-of-const-args.rs:9:5
|
LL | foo::<0, 0, 0>();
| ^^^ - help: remove this generic argument
| ^^^ --- help: remove the unnecessary generic argument
| |
| expected 2 generic arguments
|

View File

@ -8,7 +8,7 @@ help: consider moving this generic argument to the `TryInto` trait, which takes
|
LL | let _: u32 = TryInto::<32>::try_into(5i32).unwrap();
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
help: remove these generics
help: remove the unnecessary generics
|
LL - let _: u32 = 5i32.try_into::<32>().unwrap();
LL + let _: u32 = 5i32.try_into().unwrap();
@ -27,7 +27,7 @@ error[E0107]: struct takes 0 generic arguments but 1 generic argument was suppli
--> $DIR/invalid-const-arg-for-type-param.rs:12:5
|
LL | S::<0>;
| ^----- help: remove these generics
| ^----- help: remove the unnecessary generics
| |
| expected 0 generic arguments
|

View File

@ -2,7 +2,7 @@ error[E0107]: struct takes 1 generic argument but 2 generic arguments were suppl
--> $DIR/invalid-constant-in-args.rs:4:12
|
LL | let _: Cell<&str, "a"> = Cell::new("");
| ^^^^ --- help: remove this generic argument
| ^^^^ ----- help: remove the unnecessary generic argument
| |
| expected 1 generic argument

View File

@ -20,7 +20,7 @@ error[E0107]: struct takes 2 lifetime arguments but 3 lifetime arguments were su
--> $DIR/constructor-lifetime-args.rs:19:5
|
LL | S::<'static, 'static, 'static>(&0, &0);
| ^ ------- help: remove this lifetime argument
| ^ --------- help: remove the lifetime argument
| |
| expected 2 lifetime arguments
|
@ -52,7 +52,7 @@ error[E0107]: enum takes 2 lifetime arguments but 3 lifetime arguments were supp
--> $DIR/constructor-lifetime-args.rs:24:8
|
LL | E::V::<'static, 'static, 'static>(&0);
| ^ ------- help: remove this lifetime argument
| ^ --------- help: remove the lifetime argument
| |
| expected 2 lifetime arguments
|

View File

@ -2,7 +2,7 @@ error[E0107]: method takes 0 generic arguments but 1 generic argument was suppli
--> $DIR/effect_param.rs:11:9
|
LL | i8::checked_sub::<false>(42, 43);
| ^^^^^^^^^^^--------- help: remove these generics
| ^^^^^^^^^^^--------- help: remove the unnecessary generics
| |
| expected 0 generic arguments
@ -10,7 +10,7 @@ error[E0107]: method takes 0 generic arguments but 1 generic argument was suppli
--> $DIR/effect_param.rs:13:9
|
LL | i8::checked_sub::<true>(42, 43);
| ^^^^^^^^^^^-------- help: remove these generics
| ^^^^^^^^^^^-------- help: remove the unnecessary generics
| |
| expected 0 generic arguments
@ -18,7 +18,7 @@ error[E0107]: method takes 0 generic arguments but 1 generic argument was suppli
--> $DIR/effect_param.rs:4:9
|
LL | i8::checked_sub::<true>(42, 43);
| ^^^^^^^^^^^-------- help: remove these generics
| ^^^^^^^^^^^-------- help: remove the unnecessary generics
| |
| expected 0 generic arguments
@ -26,7 +26,7 @@ error[E0107]: method takes 0 generic arguments but 1 generic argument was suppli
--> $DIR/effect_param.rs:6:9
|
LL | i8::checked_sub::<false>(42, 43);
| ^^^^^^^^^^^--------- help: remove these generics
| ^^^^^^^^^^^--------- help: remove the unnecessary generics
| |
| expected 0 generic arguments

View File

@ -16,35 +16,35 @@ struct Baz<'a, 'b, 'c> {
bar: Bar<'a>,
//~^ ERROR enum takes 0 lifetime arguments
//~| HELP remove these generics
//~| HELP remove the unnecessary generics
foo2: Foo<'a, 'b, 'c>,
//~^ ERROR struct takes 1 lifetime argument
//~| HELP remove these lifetime arguments
//~| HELP remove the lifetime arguments
qux1: Qux<'a, 'b, i32>,
//~^ ERROR struct takes 1 lifetime argument
//~| HELP remove this lifetime argument
//~| HELP remove the lifetime argument
qux2: Qux<'a, i32, 'b>,
//~^ ERROR struct takes 1 lifetime argument
//~| HELP remove this lifetime argument
//~| HELP remove the lifetime argument
qux3: Qux<'a, 'b, 'c, i32>,
//~^ ERROR struct takes 1 lifetime argument
//~| HELP remove these lifetime arguments
//~| HELP remove the lifetime arguments
qux4: Qux<'a, i32, 'b, 'c>,
//~^ ERROR struct takes 1 lifetime argument
//~| HELP remove these lifetime arguments
//~| HELP remove the lifetime arguments
qux5: Qux<'a, 'b, i32, 'c>,
//~^ ERROR struct takes 1 lifetime argument
//~| HELP remove this lifetime argument
//~| HELP remove the lifetime argument
quux: Quux<'a, i32, 'b>,
//~^ ERROR struct takes 0 lifetime arguments
//~| HELP remove this lifetime argument
//~| HELP remove the lifetime argument
}
pub trait T {

View File

@ -20,7 +20,7 @@ error[E0107]: enum takes 0 lifetime arguments but 1 lifetime argument was suppli
--> $DIR/E0107.rs:17:10
|
LL | bar: Bar<'a>,
| ^^^---- help: remove these generics
| ^^^---- help: remove the unnecessary generics
| |
| expected 0 lifetime arguments
|
@ -34,7 +34,7 @@ error[E0107]: struct takes 1 lifetime argument but 3 lifetime arguments were sup
--> $DIR/E0107.rs:21:11
|
LL | foo2: Foo<'a, 'b, 'c>,
| ^^^ ------ help: remove these lifetime arguments
| ^^^ -------- help: remove the lifetime arguments
| |
| expected 1 lifetime argument
|
@ -48,7 +48,7 @@ error[E0107]: struct takes 1 lifetime argument but 2 lifetime arguments were sup
--> $DIR/E0107.rs:25:11
|
LL | qux1: Qux<'a, 'b, i32>,
| ^^^ -- help: remove this lifetime argument
| ^^^ ---- help: remove the lifetime argument
| |
| expected 1 lifetime argument
|
@ -62,7 +62,7 @@ error[E0107]: struct takes 1 lifetime argument but 2 lifetime arguments were sup
--> $DIR/E0107.rs:29:11
|
LL | qux2: Qux<'a, i32, 'b>,
| ^^^ -- help: remove this lifetime argument
| ^^^ --------- help: remove the lifetime argument
| |
| expected 1 lifetime argument
|
@ -76,7 +76,7 @@ error[E0107]: struct takes 1 lifetime argument but 3 lifetime arguments were sup
--> $DIR/E0107.rs:33:11
|
LL | qux3: Qux<'a, 'b, 'c, i32>,
| ^^^ ------ help: remove these lifetime arguments
| ^^^ -------- help: remove the lifetime arguments
| |
| expected 1 lifetime argument
|
@ -90,7 +90,7 @@ error[E0107]: struct takes 1 lifetime argument but 3 lifetime arguments were sup
--> $DIR/E0107.rs:37:11
|
LL | qux4: Qux<'a, i32, 'b, 'c>,
| ^^^ ------ help: remove these lifetime arguments
| ^^^ ------------- help: remove the lifetime arguments
| |
| expected 1 lifetime argument
|
@ -104,7 +104,7 @@ error[E0107]: struct takes 1 lifetime argument but 3 lifetime arguments were sup
--> $DIR/E0107.rs:41:11
|
LL | qux5: Qux<'a, 'b, i32, 'c>,
| ^^^ -- help: remove this lifetime argument
| ^^^ ---- help: remove the lifetime argument
| |
| expected 1 lifetime argument
|
@ -118,7 +118,7 @@ error[E0107]: struct takes 0 lifetime arguments but 2 lifetime arguments were su
--> $DIR/E0107.rs:45:11
|
LL | quux: Quux<'a, i32, 'b>,
| ^^^^ -- help: remove this lifetime argument
| ^^^^ -- help: remove the lifetime argument
| |
| expected 0 lifetime arguments
|

View File

@ -43,7 +43,7 @@ error[E0107]: associated type takes 0 generic arguments but 1 generic argument w
--> $DIR/gat-trait-path-parenthesised-args.rs:5:27
|
LL | fn foo<'a>(arg: Box<dyn X<Y('a) = &'a ()>>) {}
| ^---- help: remove these generics
| ^---- help: remove the unnecessary generics
| |
| expected 0 generic arguments
|
@ -74,7 +74,7 @@ error[E0107]: associated type takes 0 generic arguments but 1 generic argument w
--> $DIR/gat-trait-path-parenthesised-args.rs:5:27
|
LL | fn foo<'a>(arg: Box<dyn X<Y('a) = &'a ()>>) {}
| ^---- help: remove these generics
| ^---- help: remove the unnecessary generics
| |
| expected 0 generic arguments
|
@ -106,7 +106,7 @@ error[E0107]: associated type takes 0 generic arguments but 1 generic argument w
--> $DIR/gat-trait-path-parenthesised-args.rs:5:27
|
LL | fn foo<'a>(arg: Box<dyn X<Y('a) = &'a ()>>) {}
| ^---- help: remove these generics
| ^---- help: remove the unnecessary generics
| |
| expected 0 generic arguments
|

View File

@ -2,7 +2,7 @@ error[E0107]: associated type takes 1 lifetime argument but 2 lifetime arguments
--> $DIR/parameter_number_and_kind.rs:11:24
|
LL | type FErr1 = Self::E<'static, 'static>;
| ^ ------- help: remove this lifetime argument
| ^ --------- help: remove the lifetime argument
| |
| expected 1 lifetime argument
|
@ -32,7 +32,7 @@ error[E0107]: associated type takes 1 generic argument but 2 generic arguments w
--> $DIR/parameter_number_and_kind.rs:14:27
|
LL | type FErr2<T> = Self::E<'static, T, u32>;
| ^ --- help: remove this generic argument
| ^ ----- help: remove the unnecessary generic argument
| |
| expected 1 generic argument
|

View File

@ -18,7 +18,7 @@ error[E0107]: associated type takes 0 generic arguments but 1 generic argument w
--> $DIR/trait-path-type-error-once-implemented.rs:6:29
|
LL | fn f2<'a>(arg : Box<dyn X<Y<1> = &'a ()>>) {}
| ^--- help: remove these generics
| ^--- help: remove the unnecessary generics
| |
| expected 0 generic arguments
|
@ -49,7 +49,7 @@ error[E0107]: associated type takes 0 generic arguments but 1 generic argument w
--> $DIR/trait-path-type-error-once-implemented.rs:6:29
|
LL | fn f2<'a>(arg : Box<dyn X<Y<1> = &'a ()>>) {}
| ^--- help: remove these generics
| ^--- help: remove the unnecessary generics
| |
| expected 0 generic arguments
|
@ -81,7 +81,7 @@ error[E0107]: associated type takes 0 generic arguments but 1 generic argument w
--> $DIR/trait-path-type-error-once-implemented.rs:6:29
|
LL | fn f2<'a>(arg : Box<dyn X<Y<1> = &'a ()>>) {}
| ^--- help: remove these generics
| ^--- help: remove the unnecessary generics
| |
| expected 0 generic arguments
|

View File

@ -2,7 +2,7 @@ error[E0107]: associated function takes 1 generic argument but 2 generic argumen
--> $DIR/bad-mid-path-type-params.rs:30:16
|
LL | let _ = S::new::<isize,f64>(1, 1.0);
| ^^^ --- help: remove this generic argument
| ^^^ ---- help: remove the unnecessary generic argument
| |
| expected 1 generic argument
|
@ -16,7 +16,7 @@ error[E0107]: struct takes 0 lifetime arguments but 1 lifetime argument was supp
--> $DIR/bad-mid-path-type-params.rs:33:13
|
LL | let _ = S::<'a,isize>::new::<f64>(1, 1.0);
| ^ -- help: remove this lifetime argument
| ^ -- help: remove the lifetime argument
| |
| expected 0 lifetime arguments
|
@ -30,7 +30,7 @@ error[E0107]: associated function takes 1 generic argument but 2 generic argumen
--> $DIR/bad-mid-path-type-params.rs:36:24
|
LL | let _: S2 = Trait::new::<isize,f64>(1, 1.0);
| ^^^ --- help: remove this generic argument
| ^^^ ---- help: remove the unnecessary generic argument
| |
| expected 1 generic argument
|
@ -44,7 +44,7 @@ error[E0107]: trait takes 0 lifetime arguments but 1 lifetime argument was suppl
--> $DIR/bad-mid-path-type-params.rs:39:17
|
LL | let _: S2 = Trait::<'a,isize>::new::<f64,f64>(1, 1.0);
| ^^^^^ -- help: remove this lifetime argument
| ^^^^^ -- help: remove the lifetime argument
| |
| expected 0 lifetime arguments
|
@ -58,7 +58,7 @@ error[E0107]: associated function takes 1 generic argument but 2 generic argumen
--> $DIR/bad-mid-path-type-params.rs:39:36
|
LL | let _: S2 = Trait::<'a,isize>::new::<f64,f64>(1, 1.0);
| ^^^ --- help: remove this generic argument
| ^^^ ---- help: remove the unnecessary generic argument
| |
| expected 1 generic argument
|

View File

@ -20,7 +20,7 @@ error[E0107]: function takes 1 lifetime argument but 2 lifetime arguments were s
--> $DIR/foreign-generic-mismatch.rs:8:31
|
LL | foreign_generic_mismatch::lt_arg::<'static, 'static>();
| ^^^^^^ ------- help: remove this lifetime argument
| ^^^^^^ --------- help: remove the lifetime argument
| |
| expected 1 lifetime argument
|

View File

@ -2,7 +2,7 @@ error[E0107]: struct takes 1 lifetime argument but 2 lifetime arguments were sup
--> $DIR/generic-arg-mismatch-recover.rs:6:5
|
LL | Foo::<'static, 'static, ()>(&0);
| ^^^ ------- help: remove this lifetime argument
| ^^^ --------- help: remove the lifetime argument
| |
| expected 1 lifetime argument
|
@ -16,7 +16,7 @@ error[E0107]: struct takes 1 lifetime argument but 2 lifetime arguments were sup
--> $DIR/generic-arg-mismatch-recover.rs:9:5
|
LL | Bar::<'static, 'static, ()>(&());
| ^^^ ------- help: remove this lifetime argument
| ^^^ --------- help: remove the lifetime argument
| |
| expected 1 lifetime argument
|
@ -30,7 +30,7 @@ error[E0107]: struct takes 0 generic arguments but 1 generic argument was suppli
--> $DIR/generic-arg-mismatch-recover.rs:9:5
|
LL | Bar::<'static, 'static, ()>(&());
| ^^^ -- help: remove this generic argument
| ^^^ -- help: remove the unnecessary generic argument
| |
| expected 0 generic arguments
|

View File

@ -2,7 +2,7 @@ error[E0107]: struct takes at most 2 generic arguments but 3 generic arguments w
--> $DIR/generic-impl-more-params-with-defaults.rs:13:5
|
LL | Vec::<isize, Heap, bool>::new();
| ^^^ ---- help: remove this generic argument
| ^^^ ------ help: remove the unnecessary generic argument
| |
| expected at most 2 generic arguments
|

View File

@ -2,7 +2,7 @@ error[E0107]: struct takes at most 2 generic arguments but 3 generic arguments w
--> $DIR/generic-type-more-params-with-defaults.rs:9:12
|
LL | let _: Vec<isize, Heap, bool>;
| ^^^ ---- help: remove this generic argument
| ^^^ ------ help: remove the unnecessary generic argument
| |
| expected at most 2 generic arguments
|

View File

@ -5,19 +5,19 @@ mod no_generics {
type B = Ty<'static>;
//~^ ERROR struct takes 0 lifetime arguments but 1 lifetime argument
//~| HELP remove these generics
//~| HELP remove the unnecessary generics
type C = Ty<'static, usize>;
//~^ ERROR struct takes 0 lifetime arguments but 1 lifetime argument
//~| ERROR struct takes 0 generic arguments but 1 generic argument
//~| HELP remove this lifetime argument
//~| HELP remove this generic argument
//~| HELP remove the lifetime argument
//~| HELP remove the unnecessary generic argument
type D = Ty<'static, usize, { 0 }>;
//~^ ERROR struct takes 0 lifetime arguments but 1 lifetime argument
//~| ERROR struct takes 0 generic arguments but 2 generic arguments
//~| HELP remove this lifetime argument
//~| HELP remove these generic arguments
//~| HELP remove the lifetime argument
//~| HELP remove the unnecessary generic arguments
}
mod type_and_type {
@ -35,7 +35,7 @@ mod type_and_type {
type D = Ty<usize, String, char>;
//~^ ERROR struct takes 2 generic arguments but 3 generic arguments
//~| HELP remove this
//~| HELP remove the
type E = Ty<>;
//~^ ERROR struct takes 2 generic arguments but 0 generic arguments were supplied
@ -70,8 +70,8 @@ mod lifetime_and_type {
type F = Ty<'static, usize, 'static, usize>;
//~^ ERROR struct takes 1 lifetime argument but 2 lifetime arguments
//~| ERROR struct takes 1 generic argument but 2 generic arguments
//~| HELP remove this lifetime argument
//~| HELP remove this generic argument
//~| HELP remove the lifetime argument
//~| HELP remove the unnecessary generic argument
}
mod type_and_type_and_type {
@ -317,13 +317,13 @@ mod stdlib {
type C = HashMap<'static>;
//~^ ERROR struct takes 0 lifetime arguments but 1 lifetime argument
//~| HELP remove these generics
//~| HELP remove the
//~| ERROR struct takes at least 2
//~| HELP add missing
type D = HashMap<usize, String, char, f64>;
//~^ ERROR struct takes at most 3
//~| HELP remove this
//~| HELP remove the
type E = HashMap<>;
//~^ ERROR struct takes at least 2 generic arguments but 0 generic arguments
@ -341,7 +341,7 @@ mod stdlib {
type C = Result<'static>;
//~^ ERROR enum takes 0 lifetime arguments but 1 lifetime argument
//~| HELP remove these generics
//~| HELP remove the unnecessary generics
//~| ERROR enum takes 2 generic arguments but 0 generic arguments
//~| HELP add missing

View File

@ -171,7 +171,7 @@ error[E0107]: struct takes 0 lifetime arguments but 1 lifetime argument was supp
--> $DIR/wrong-number-of-args.rs:6:14
|
LL | type B = Ty<'static>;
| ^^--------- help: remove these generics
| ^^--------- help: remove the unnecessary generics
| |
| expected 0 lifetime arguments
|
@ -185,7 +185,7 @@ error[E0107]: struct takes 0 lifetime arguments but 1 lifetime argument was supp
--> $DIR/wrong-number-of-args.rs:10:14
|
LL | type C = Ty<'static, usize>;
| ^^ ------- help: remove this lifetime argument
| ^^ ------- help: remove the lifetime argument
| |
| expected 0 lifetime arguments
|
@ -199,7 +199,7 @@ error[E0107]: struct takes 0 generic arguments but 1 generic argument was suppli
--> $DIR/wrong-number-of-args.rs:10:14
|
LL | type C = Ty<'static, usize>;
| ^^ ----- help: remove this generic argument
| ^^ ----- help: remove the unnecessary generic argument
| |
| expected 0 generic arguments
|
@ -213,7 +213,7 @@ error[E0107]: struct takes 0 lifetime arguments but 1 lifetime argument was supp
--> $DIR/wrong-number-of-args.rs:16:14
|
LL | type D = Ty<'static, usize, { 0 }>;
| ^^ ------- help: remove this lifetime argument
| ^^ ------- help: remove the lifetime argument
| |
| expected 0 lifetime arguments
|
@ -227,7 +227,7 @@ error[E0107]: struct takes 0 generic arguments but 2 generic arguments were supp
--> $DIR/wrong-number-of-args.rs:16:14
|
LL | type D = Ty<'static, usize, { 0 }>;
| ^^ ------------ help: remove these generic arguments
| ^^ ------- help: remove the unnecessary generic arguments
| |
| expected 0 generic arguments
|
@ -275,7 +275,7 @@ error[E0107]: struct takes 2 generic arguments but 3 generic arguments were supp
--> $DIR/wrong-number-of-args.rs:36:14
|
LL | type D = Ty<usize, String, char>;
| ^^ ---- help: remove this generic argument
| ^^ ------ help: remove the unnecessary generic argument
| |
| expected 2 generic arguments
|
@ -353,7 +353,7 @@ error[E0107]: struct takes 1 lifetime argument but 2 lifetime arguments were sup
--> $DIR/wrong-number-of-args.rs:70:14
|
LL | type F = Ty<'static, usize, 'static, usize>;
| ^^ ------- help: remove this lifetime argument
| ^^ ---------------- help: remove the lifetime argument
| |
| expected 1 lifetime argument
|
@ -367,7 +367,7 @@ error[E0107]: struct takes 1 generic argument but 2 generic arguments were suppl
--> $DIR/wrong-number-of-args.rs:70:14
|
LL | type F = Ty<'static, usize, 'static, usize>;
| ^^ ----- help: remove this generic argument
| ^^ ---------------- help: remove the unnecessary generic argument
| |
| expected 1 generic argument
|
@ -415,7 +415,7 @@ error[E0107]: struct takes at most 3 generic arguments but 4 generic arguments w
--> $DIR/wrong-number-of-args.rs:92:14
|
LL | type E = Ty<usize, String, char, f64>;
| ^^ --- help: remove this generic argument
| ^^ ----- help: remove the unnecessary generic argument
| |
| expected at most 3 generic arguments
|
@ -445,7 +445,7 @@ error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplie
--> $DIR/wrong-number-of-args.rs:116:22
|
LL | type A = Box<dyn NonGeneric<usize>>;
| ^^^^^^^^^^------- help: remove these generics
| ^^^^^^^^^^------- help: remove the unnecessary generics
| |
| expected 0 generic arguments
|
@ -459,7 +459,7 @@ error[E0107]: trait takes 1 lifetime argument but 2 lifetime arguments were supp
--> $DIR/wrong-number-of-args.rs:125:22
|
LL | type C = Box<dyn GenericLifetime<'static, 'static>>;
| ^^^^^^^^^^^^^^^ ------- help: remove this lifetime argument
| ^^^^^^^^^^^^^^^ --------- help: remove the lifetime argument
| |
| expected 1 lifetime argument
|
@ -489,7 +489,7 @@ error[E0107]: trait takes 1 generic argument but 2 generic arguments were suppli
--> $DIR/wrong-number-of-args.rs:133:22
|
LL | type E = Box<dyn GenericType<String, usize>>;
| ^^^^^^^^^^^ ----- help: remove this generic argument
| ^^^^^^^^^^^ ------- help: remove the unnecessary generic argument
| |
| expected 1 generic argument
|
@ -519,7 +519,7 @@ error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplie
--> $DIR/wrong-number-of-args.rs:153:26
|
LL | type A = Box<dyn NonGenericAT<usize, AssocTy=()>>;
| ^^^^^^^^^^^^------------------- help: remove these generics
| ^^^^^^^^^^^^------------------- help: remove the unnecessary generics
| |
| expected 0 generic arguments
|
@ -533,7 +533,7 @@ error[E0107]: trait takes 1 lifetime argument but 2 lifetime arguments were supp
--> $DIR/wrong-number-of-args.rs:168:26
|
LL | type B = Box<dyn GenericLifetimeAT<'static, 'static, AssocTy=()>>;
| ^^^^^^^^^^^^^^^^^ ------- help: remove this lifetime argument
| ^^^^^^^^^^^^^^^^^ --------- help: remove the lifetime argument
| |
| expected 1 lifetime argument
|
@ -547,7 +547,7 @@ error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplie
--> $DIR/wrong-number-of-args.rs:172:26
|
LL | type C = Box<dyn GenericLifetimeAT<(), AssocTy=()>>;
| ^^^^^^^^^^^^^^^^^ -- help: remove this generic argument
| ^^^^^^^^^^^^^^^^^ -- help: remove the unnecessary generic argument
| |
| expected 0 generic arguments
|
@ -577,7 +577,7 @@ error[E0107]: trait takes 1 generic argument but 2 generic arguments were suppli
--> $DIR/wrong-number-of-args.rs:189:26
|
LL | type B = Box<dyn GenericTypeAT<(), (), AssocTy=()>>;
| ^^^^^^^^^^^^^ -- help: remove this generic argument
| ^^^^^^^^^^^^^ ---- help: remove the unnecessary generic argument
| |
| expected 1 generic argument
|
@ -591,7 +591,7 @@ error[E0107]: trait takes 0 lifetime arguments but 1 lifetime argument was suppl
--> $DIR/wrong-number-of-args.rs:193:26
|
LL | type C = Box<dyn GenericTypeAT<'static, AssocTy=()>>;
| ^^^^^^^^^^^^^--------------------- help: remove these generics
| ^^^^^^^^^^^^^--------------------- help: remove the unnecessary generics
| |
| expected 0 lifetime arguments
|
@ -653,7 +653,7 @@ error[E0107]: trait takes 1 lifetime argument but 2 lifetime arguments were supp
--> $DIR/wrong-number-of-args.rs:216:26
|
LL | type C = Box<dyn GenericLifetimeTypeAT<'static, 'static, AssocTy=()>>;
| ^^^^^^^^^^^^^^^^^^^^^ ------- help: remove this lifetime argument
| ^^^^^^^^^^^^^^^^^^^^^ --------- help: remove the lifetime argument
| |
| expected 1 lifetime argument
|
@ -683,7 +683,7 @@ error[E0107]: trait takes 1 generic argument but 2 generic arguments were suppli
--> $DIR/wrong-number-of-args.rs:227:26
|
LL | type E = Box<dyn GenericLifetimeTypeAT<(), (), AssocTy=()>>;
| ^^^^^^^^^^^^^^^^^^^^^ -- help: remove this generic argument
| ^^^^^^^^^^^^^^^^^^^^^ ---- help: remove the unnecessary generic argument
| |
| expected 1 generic argument
|
@ -697,7 +697,7 @@ error[E0107]: trait takes 1 lifetime argument but 2 lifetime arguments were supp
--> $DIR/wrong-number-of-args.rs:234:26
|
LL | type F = Box<dyn GenericLifetimeTypeAT<'static, 'static, (), AssocTy=()>>;
| ^^^^^^^^^^^^^^^^^^^^^ ------- help: remove this lifetime argument
| ^^^^^^^^^^^^^^^^^^^^^ --------- help: remove the lifetime argument
| |
| expected 1 lifetime argument
|
@ -711,7 +711,7 @@ error[E0107]: trait takes 1 generic argument but 2 generic arguments were suppli
--> $DIR/wrong-number-of-args.rs:238:26
|
LL | type G = Box<dyn GenericLifetimeTypeAT<'static, (), (), AssocTy=()>>;
| ^^^^^^^^^^^^^^^^^^^^^ -- help: remove this generic argument
| ^^^^^^^^^^^^^^^^^^^^^ ---- help: remove the unnecessary generic argument
| |
| expected 1 generic argument
|
@ -725,7 +725,7 @@ error[E0107]: trait takes 1 lifetime argument but 2 lifetime arguments were supp
--> $DIR/wrong-number-of-args.rs:242:26
|
LL | type H = Box<dyn GenericLifetimeTypeAT<'static, 'static, (), (), AssocTy=()>>;
| ^^^^^^^^^^^^^^^^^^^^^ ------- help: remove this lifetime argument
| ^^^^^^^^^^^^^^^^^^^^^ --------- help: remove the lifetime argument
| |
| expected 1 lifetime argument
|
@ -739,7 +739,7 @@ error[E0107]: trait takes 1 generic argument but 2 generic arguments were suppli
--> $DIR/wrong-number-of-args.rs:242:26
|
LL | type H = Box<dyn GenericLifetimeTypeAT<'static, 'static, (), (), AssocTy=()>>;
| ^^^^^^^^^^^^^^^^^^^^^ -- help: remove this generic argument
| ^^^^^^^^^^^^^^^^^^^^^ ---- help: remove the unnecessary generic argument
| |
| expected 1 generic argument
|
@ -787,7 +787,7 @@ error[E0107]: trait takes 2 generic arguments but 3 generic arguments were suppl
--> $DIR/wrong-number-of-args.rs:262:26
|
LL | type C = Box<dyn GenericTypeTypeAT<(), (), (), AssocTy=()>>;
| ^^^^^^^^^^^^^^^^^ -- help: remove this generic argument
| ^^^^^^^^^^^^^^^^^ ---- help: remove the unnecessary generic argument
| |
| expected 2 generic arguments
|
@ -911,7 +911,7 @@ error[E0107]: struct takes 0 lifetime arguments but 1 lifetime argument was supp
--> $DIR/wrong-number-of-args.rs:318:18
|
LL | type C = HashMap<'static>;
| ^^^^^^^--------- help: remove these generics
| ^^^^^^^--------- help: remove the unnecessary generics
| |
| expected 0 lifetime arguments
@ -930,7 +930,7 @@ error[E0107]: struct takes at most 3 generic arguments but 4 generic arguments w
--> $DIR/wrong-number-of-args.rs:324:18
|
LL | type D = HashMap<usize, String, char, f64>;
| ^^^^^^^ --- help: remove this generic argument
| ^^^^^^^ ----- help: remove the unnecessary generic argument
| |
| expected at most 3 generic arguments
@ -973,7 +973,7 @@ error[E0107]: enum takes 0 lifetime arguments but 1 lifetime argument was suppli
--> $DIR/wrong-number-of-args.rs:342:18
|
LL | type C = Result<'static>;
| ^^^^^^--------- help: remove these generics
| ^^^^^^--------- help: remove the unnecessary generics
| |
| expected 0 lifetime arguments
@ -992,7 +992,7 @@ error[E0107]: enum takes 2 generic arguments but 3 generic arguments were suppli
--> $DIR/wrong-number-of-args.rs:348:18
|
LL | type D = Result<usize, String, char>;
| ^^^^^^ ---- help: remove this generic argument
| ^^^^^^ ------ help: remove the unnecessary generic argument
| |
| expected 2 generic arguments

View File

@ -2,7 +2,7 @@ error[E0107]: function takes 1 generic argument but 2 generic arguments were sup
--> $DIR/explicit-generic-args-for-impl.rs:4:5
|
LL | foo::<str, String>("".to_string());
| ^^^ ------ help: remove this generic argument
| ^^^ -------- help: remove the unnecessary generic argument
| |
| expected 1 generic argument
|

View File

@ -38,7 +38,7 @@ error[E0107]: struct takes 0 generic arguments but 1 generic argument was suppli
--> $DIR/opaque-and-lifetime-mismatch.rs:4:17
|
LL | fn bar() -> Wrapper<impl Sized>;
| ^^^^^^^ ---------- help: remove this generic argument
| ^^^^^^^ ---------- help: remove the unnecessary generic argument
| |
| expected 0 generic arguments
|
@ -52,7 +52,7 @@ error[E0107]: struct takes 0 generic arguments but 1 generic argument was suppli
--> $DIR/opaque-and-lifetime-mismatch.rs:18:17
|
LL | fn foo() -> Wrapper<impl Sized>;
| ^^^^^^^ ---------- help: remove this generic argument
| ^^^^^^^ ---------- help: remove the unnecessary generic argument
| |
| expected 0 generic arguments
|
@ -93,7 +93,7 @@ error[E0107]: struct takes 0 generic arguments but 1 generic argument was suppli
--> $DIR/opaque-and-lifetime-mismatch.rs:24:17
|
LL | fn foo() -> Wrapper<impl Sized> {
| ^^^^^^^ ---------- help: remove this generic argument
| ^^^^^^^ ---------- help: remove the unnecessary generic argument
| |
| expected 0 generic arguments
|

View File

@ -2,7 +2,7 @@ error[E0107]: struct takes 0 lifetime arguments but 1 lifetime argument was supp
--> $DIR/issue-18423.rs:4:8
|
LL | x: Box<'a, isize>
| ^^^ -- help: remove this lifetime argument
| ^^^ -- help: remove the lifetime argument
| |
| expected 0 lifetime arguments

View File

@ -2,7 +2,7 @@ error[E0107]: associated function takes 0 generic arguments but 1 generic argume
--> $DIR/issue-53251.rs:11:20
|
LL | S::f::<i64>();
| ^------- help: remove these generics
| ^------- help: remove the unnecessary generics
| |
| expected 0 generic arguments
...
@ -20,7 +20,7 @@ error[E0107]: associated function takes 0 generic arguments but 1 generic argume
--> $DIR/issue-53251.rs:11:20
|
LL | S::f::<i64>();
| ^------- help: remove these generics
| ^------- help: remove the unnecessary generics
| |
| expected 0 generic arguments
...

View File

@ -20,7 +20,7 @@ error[E0107]: method takes 0 generic arguments but 1 generic argument was suppli
--> $DIR/issue-60622.rs:10:7
|
LL | b.a::<'_, T>();
| ^ - help: remove this generic argument
| ^ - help: remove the unnecessary generic argument
| |
| expected 0 generic arguments
|

View File

@ -2,7 +2,7 @@ error[E0107]: type alias takes 1 lifetime argument but 2 lifetime arguments were
--> $DIR/mismatched_arg_count.rs:9:29
|
LL | fn bar<'a, T: Trait<'a>>(_: Alias<'a, 'a, T>) {}
| ^^^^^ -- help: remove this lifetime argument
| ^^^^^ ---- help: remove the lifetime argument
| |
| expected 1 lifetime argument
|

View File

@ -2,7 +2,7 @@ error[E0107]: struct takes 2 lifetime arguments but 3 lifetime arguments were su
--> $DIR/noisy-follow-up-erro.rs:12:30
|
LL | fn boom(&self, foo: &mut Foo<'_, '_, 'a>) -> Result<(), &'a ()> {
| ^^^ -- help: remove this lifetime argument
| ^^^ ---- help: remove the lifetime argument
| |
| expected 2 lifetime arguments
|

View File

@ -20,7 +20,7 @@ error[E0107]: method takes 2 lifetime arguments but 3 lifetime arguments were su
--> $DIR/method-call-lifetime-args-fail.rs:18:7
|
LL | S.early::<'static, 'static, 'static>();
| ^^^^^ ------- help: remove this lifetime argument
| ^^^^^ --------- help: remove the lifetime argument
| |
| expected 2 lifetime arguments
|
@ -220,7 +220,7 @@ error[E0107]: method takes 2 lifetime arguments but 3 lifetime arguments were su
--> $DIR/method-call-lifetime-args-fail.rs:65:8
|
LL | S::early::<'static, 'static, 'static>(S);
| ^^^^^ ------- help: remove this lifetime argument
| ^^^^^ --------- help: remove the lifetime argument
| |
| expected 2 lifetime arguments
|

View File

@ -12,7 +12,7 @@ error[E0107]: struct takes 0 generic arguments but 1 generic argument was suppli
--> $DIR/issue-3214.rs:6:22
|
LL | impl<T> Drop for Foo<T> {
| ^^^--- help: remove these generics
| ^^^--- help: remove the unnecessary generics
| |
| expected 0 generic arguments
|

View File

@ -2,7 +2,7 @@ error[E0107]: function takes 0 generic arguments but 1 generic argument was supp
--> $DIR/no-explicit-const-params-cross-crate.rs:14:5
|
LL | foo::<false>();
| ^^^--------- help: remove these generics
| ^^^--------- help: remove the unnecessary generics
| |
| expected 0 generic arguments
|
@ -32,7 +32,7 @@ error[E0107]: function takes 0 generic arguments but 1 generic argument was supp
--> $DIR/no-explicit-const-params-cross-crate.rs:7:5
|
LL | foo::<true>();
| ^^^-------- help: remove these generics
| ^^^-------- help: remove the unnecessary generics
| |
| expected 0 generic arguments
|

View File

@ -16,7 +16,7 @@ error[E0107]: function takes 0 generic arguments but 1 generic argument was supp
--> $DIR/no-explicit-const-params.rs:22:5
|
LL | foo::<false>();
| ^^^--------- help: remove these generics
| ^^^--------- help: remove the unnecessary generics
| |
| expected 0 generic arguments
|
@ -55,7 +55,7 @@ error[E0107]: function takes 0 generic arguments but 1 generic argument was supp
--> $DIR/no-explicit-const-params.rs:15:5
|
LL | foo::<true>();
| ^^^-------- help: remove these generics
| ^^^-------- help: remove the unnecessary generics
| |
| expected 0 generic arguments
|

View File

@ -2,7 +2,7 @@ error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplie
--> $DIR/seq-args.rs:4:13
|
LL | impl<T> Seq<T> for Vec<T> {
| ^^^--- help: remove these generics
| ^^^--- help: remove the unnecessary generics
| |
| expected 0 generic arguments
|
@ -16,7 +16,7 @@ error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplie
--> $DIR/seq-args.rs:9:10
|
LL | impl Seq<bool> for u32 {
| ^^^------ help: remove these generics
| ^^^------ help: remove the unnecessary generics
| |
| expected 0 generic arguments
|

View File

@ -8,7 +8,7 @@ error[E0107]: associated type takes 0 generic arguments but 1 generic argument w
--> $DIR/struct-path-associated-type.rs:14:16
|
LL | let z = T::A::<u8> {};
| ^------ help: remove these generics
| ^------ help: remove the unnecessary generics
| |
| expected 0 generic arguments
|
@ -34,7 +34,7 @@ error[E0107]: associated type takes 0 generic arguments but 1 generic argument w
--> $DIR/struct-path-associated-type.rs:25:16
|
LL | let z = T::A::<u8> {};
| ^------ help: remove these generics
| ^------ help: remove the unnecessary generics
| |
| expected 0 generic arguments
|

View File

@ -68,7 +68,7 @@ error[E0107]: type alias takes 0 generic arguments but 1 generic argument was su
--> $DIR/structure-constructor-type-mismatch.rs:48:15
|
LL | let pt3 = PointF::<i32> {
| ^^^^^^------- help: remove these generics
| ^^^^^^------- help: remove the unnecessary generics
| |
| expected 0 generic arguments
|
@ -104,7 +104,7 @@ error[E0107]: type alias takes 0 generic arguments but 1 generic argument was su
--> $DIR/structure-constructor-type-mismatch.rs:54:9
|
LL | PointF::<u32> { .. } => {}
| ^^^^^^------- help: remove these generics
| ^^^^^^------- help: remove the unnecessary generics
| |
| expected 0 generic arguments
|

View File

@ -2,7 +2,7 @@ error[E0107]: method takes 0 generic arguments but 1 generic argument was suppli
--> $DIR/issue-101421.rs:10:8
|
LL | ().f::<()>(());
| ^------ help: remove these generics
| ^------ help: remove the unnecessary generics
| |
| expected 0 generic arguments
|

View File

@ -2,7 +2,7 @@ error[E0107]: method takes 0 generic arguments but 1 generic argument was suppli
--> $DIR/issue-104287.rs:10:5
|
LL | foo::<()>(x);
| ^^^------ help: remove these generics
| ^^^------ help: remove the unnecessary generics
| |
| expected 0 generic arguments
|

View File

@ -16,20 +16,20 @@ impl<T, U> B<T, U> for S {}
fn main() {
let _ = A::foo::<S>();
//~^ ERROR
//~| HELP remove these generics
//~| HELP remove the unnecessary generics
//~| HELP consider moving this generic argument
let _ = B::bar::<S, S>();
//~^ ERROR
//~| HELP remove these generics
//~| HELP remove the unnecessary generics
//~| HELP consider moving these generic arguments
let _ = A::<S>::foo::<S>();
//~^ ERROR
//~| HELP remove these generics
//~| HELP remove the unnecessary generics
let _ = 42.into::<Option<_>>();
//~^ ERROR
//~| HELP remove these generics
//~| HELP remove the unnecessary generics
//~| HELP consider moving this generic argument
}

View File

@ -14,7 +14,7 @@ help: consider moving this generic argument to the `A` trait, which takes up to
LL - let _ = A::foo::<S>();
LL + let _ = A::<S>::foo();
|
help: remove these generics
help: remove the unnecessary generics
|
LL - let _ = A::foo::<S>();
LL + let _ = A::foo();
@ -36,7 +36,7 @@ help: consider moving these generic arguments to the `B` trait, which takes up t
LL - let _ = B::bar::<S, S>();
LL + let _ = B::<S, S>::bar();
|
help: remove these generics
help: remove the unnecessary generics
|
LL - let _ = B::bar::<S, S>();
LL + let _ = B::bar();
@ -46,7 +46,7 @@ error[E0107]: associated function takes 0 generic arguments but 1 generic argume
--> $DIR/issue-89064.rs:27:21
|
LL | let _ = A::<S>::foo::<S>();
| ^^^----- help: remove these generics
| ^^^----- help: remove the unnecessary generics
| |
| expected 0 generic arguments
|
@ -66,7 +66,7 @@ help: consider moving this generic argument to the `Into` trait, which takes up
|
LL | let _ = Into::<Option<_>>::into(42);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~
help: remove these generics
help: remove the unnecessary generics
|
LL - let _ = 42.into::<Option<_>>();
LL + let _ = 42.into();

View File

@ -14,5 +14,5 @@ fn main() {
1.bar::<i32>(0);
//~^ ERROR method takes 0 generic arguments but 1 generic argument was supplied
//~| HELP consider moving this generic argument to the `Foo` trait, which takes up to 1 argument
//~| HELP remove these generics
//~| HELP remove the unnecessary generics
}

View File

@ -13,7 +13,7 @@ help: consider moving this generic argument to the `Foo` trait, which takes up t
|
LL | Foo::<i32>::bar(1, 0);
| ~~~~~~~~~~~~~~~~~~~~~
help: remove these generics
help: remove the unnecessary generics
|
LL - 1.bar::<i32>(0);
LL + 1.bar(0);

View File

@ -117,7 +117,7 @@ error[E0107]: struct takes 1 generic argument but 2 generic arguments were suppl
--> $DIR/116464-invalid-assoc-type-suggestion-in-trait-impl.rs:40:58
|
LL | impl<T: Trait<u32, Assoc=String>, U> YetAnotherTrait for Struct<T, U> {}
| ^^^^^^ - help: remove this generic argument
| ^^^^^^ --- help: remove the unnecessary generic argument
| |
| expected 1 generic argument
|

View File

@ -8,7 +8,7 @@ error[E0107]: struct takes 1 lifetime argument but 2 lifetime arguments were sup
--> $DIR/vs-lifetime.rs:11:12
|
LL | let _: S<'static, 'static>;
| ^ ------- help: remove this lifetime argument
| ^ --------- help: remove the lifetime argument
| |
| expected 1 lifetime argument
|

View File

@ -2,7 +2,7 @@ error[E0107]: method takes 0 generic arguments but 1 generic argument was suppli
--> $DIR/test-2.rs:9:8
|
LL | 10.dup::<i32>();
| ^^^------- help: remove these generics
| ^^^------- help: remove the unnecessary generics
| |
| expected 0 generic arguments
|
@ -16,7 +16,7 @@ error[E0107]: method takes 1 generic argument but 2 generic arguments were suppl
--> $DIR/test-2.rs:11:8
|
LL | 10.blah::<i32, i32>();
| ^^^^ --- help: remove this generic argument
| ^^^^ ----- help: remove the unnecessary generic argument
| |
| expected 1 generic argument
|

View File

@ -3,11 +3,13 @@ error[E0107]: trait takes at most 2 generic arguments but 5 generic arguments we
|
LL | Dst: BikeshedIntrinsicFrom<
| ^^^^^^^^^^^^^^^^^^^^^ expected at most 2 generic arguments
...
LL | / ASSUME_LIFETIMES,
LL | Src,
LL | ASSUME_ALIGNMENT,
| _____________________________-
LL | | ASSUME_LIFETIMES,
LL | | ASSUME_VALIDITY,
LL | | ASSUME_VISIBILITY,
| |_____________________________- help: remove these generic arguments
| |_____________________________- help: remove the unnecessary generic arguments
error: aborting due to 1 previous error

View File

@ -308,7 +308,7 @@ error[E0107]: type alias takes 0 generic arguments but 1 generic argument was su
--> $DIR/enum-variant-generic-args.rs:64:5
|
LL | AliasFixed::<()>::TSVariant(());
| ^^^^^^^^^^------ help: remove these generics
| ^^^^^^^^^^------ help: remove the unnecessary generics
| |
| expected 0 generic arguments
|
@ -322,7 +322,7 @@ error[E0107]: type alias takes 0 generic arguments but 1 generic argument was su
--> $DIR/enum-variant-generic-args.rs:66:5
|
LL | AliasFixed::<()>::TSVariant::<()>(());
| ^^^^^^^^^^------ help: remove these generics
| ^^^^^^^^^^------ help: remove the unnecessary generics
| |
| expected 0 generic arguments
|
@ -399,7 +399,7 @@ error[E0107]: type alias takes 0 generic arguments but 1 generic argument was su
--> $DIR/enum-variant-generic-args.rs:82:5
|
LL | AliasFixed::<()>::SVariant { v: () };
| ^^^^^^^^^^------ help: remove these generics
| ^^^^^^^^^^------ help: remove the unnecessary generics
| |
| expected 0 generic arguments
|
@ -413,7 +413,7 @@ error[E0107]: type alias takes 0 generic arguments but 1 generic argument was su
--> $DIR/enum-variant-generic-args.rs:84:5
|
LL | AliasFixed::<()>::SVariant::<()> { v: () };
| ^^^^^^^^^^------ help: remove these generics
| ^^^^^^^^^^------ help: remove the unnecessary generics
| |
| expected 0 generic arguments
|
@ -474,7 +474,7 @@ error[E0107]: type alias takes 0 generic arguments but 1 generic argument was su
--> $DIR/enum-variant-generic-args.rs:100:5
|
LL | AliasFixed::<()>::UVariant;
| ^^^^^^^^^^------ help: remove these generics
| ^^^^^^^^^^------ help: remove the unnecessary generics
| |
| expected 0 generic arguments
|
@ -488,7 +488,7 @@ error[E0107]: type alias takes 0 generic arguments but 1 generic argument was su
--> $DIR/enum-variant-generic-args.rs:102:5
|
LL | AliasFixed::<()>::UVariant::<()>;
| ^^^^^^^^^^------ help: remove these generics
| ^^^^^^^^^^------ help: remove the unnecessary generics
| |
| expected 0 generic arguments
|

View File

@ -2,7 +2,7 @@ error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplie
--> $DIR/typeck-builtin-bound-type-parameters.rs:1:11
|
LL | fn foo1<T:Copy<U>, U>(x: T) {}
| ^^^^--- help: remove these generics
| ^^^^--- help: remove the unnecessary generics
| |
| expected 0 generic arguments
@ -10,7 +10,7 @@ error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplie
--> $DIR/typeck-builtin-bound-type-parameters.rs:4:14
|
LL | trait Trait: Copy<dyn Send> {}
| ^^^^---------- help: remove these generics
| ^^^^---------- help: remove the unnecessary generics
| |
| expected 0 generic arguments
@ -18,7 +18,7 @@ error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplie
--> $DIR/typeck-builtin-bound-type-parameters.rs:4:14
|
LL | trait Trait: Copy<dyn Send> {}
| ^^^^---------- help: remove these generics
| ^^^^---------- help: remove the unnecessary generics
| |
| expected 0 generic arguments
|
@ -28,7 +28,7 @@ error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplie
--> $DIR/typeck-builtin-bound-type-parameters.rs:4:14
|
LL | trait Trait: Copy<dyn Send> {}
| ^^^^---------- help: remove these generics
| ^^^^---------- help: remove the unnecessary generics
| |
| expected 0 generic arguments
|
@ -38,7 +38,7 @@ error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplie
--> $DIR/typeck-builtin-bound-type-parameters.rs:9:21
|
LL | struct MyStruct1<T: Copy<T>>(T);
| ^^^^--- help: remove these generics
| ^^^^--- help: remove the unnecessary generics
| |
| expected 0 generic arguments
@ -46,7 +46,7 @@ error[E0107]: trait takes 0 lifetime arguments but 1 lifetime argument was suppl
--> $DIR/typeck-builtin-bound-type-parameters.rs:12:25
|
LL | struct MyStruct2<'a, T: Copy<'a>>(&'a T);
| ^^^^---- help: remove these generics
| ^^^^---- help: remove the unnecessary generics
| |
| expected 0 lifetime arguments
@ -54,7 +54,7 @@ error[E0107]: trait takes 0 lifetime arguments but 1 lifetime argument was suppl
--> $DIR/typeck-builtin-bound-type-parameters.rs:15:15
|
LL | fn foo2<'a, T:Copy<'a, U>, U>(x: T) {}
| ^^^^ -- help: remove this lifetime argument
| ^^^^ -- help: remove the lifetime argument
| |
| expected 0 lifetime arguments
@ -62,7 +62,7 @@ error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplie
--> $DIR/typeck-builtin-bound-type-parameters.rs:15:15
|
LL | fn foo2<'a, T:Copy<'a, U>, U>(x: T) {}
| ^^^^ - help: remove this generic argument
| ^^^^ - help: remove the unnecessary generic argument
| |
| expected 0 generic arguments

View File

@ -2,7 +2,7 @@ error[E0107]: struct takes 1 generic argument but 2 generic arguments were suppl
--> $DIR/typeck_type_placeholder_lifetime_1.rs:9:12
|
LL | let c: Foo<_, _> = Foo { r: &5 };
| ^^^ - help: remove this generic argument
| ^^^ --- help: remove the unnecessary generic argument
| |
| expected 1 generic argument
|

View File

@ -2,7 +2,7 @@ error[E0107]: struct takes 1 generic argument but 2 generic arguments were suppl
--> $DIR/typeck_type_placeholder_lifetime_2.rs:9:12
|
LL | let c: Foo<_, usize> = Foo { r: &5 };
| ^^^ ----- help: remove this generic argument
| ^^^ ------- help: remove the unnecessary generic argument
| |
| expected 1 generic argument
|

View File

@ -34,7 +34,7 @@ error[E0107]: method takes 0 generic arguments but 1 generic argument was suppli
--> $DIR/ufcs-qpath-missing-params.rs:17:26
|
LL | <String as IntoCow>::into_cow::<str>("foo".to_string());
| ^^^^^^^^------- help: remove these generics
| ^^^^^^^^------- help: remove the unnecessary generics
| |
| expected 0 generic arguments
|

View File

@ -2,7 +2,7 @@ error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplie
--> $DIR/unboxed-closure-sugar-wrong-number-number-type-parameters.rs:5:17
|
LL | fn foo1(_: &dyn Zero()) {
| ^^^^-- help: remove these parenthetical generics
| ^^^^-- help: remove the unnecessary parenthetical generics
| |
| expected 0 generic arguments
|
@ -22,7 +22,7 @@ error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplie
--> $DIR/unboxed-closure-sugar-wrong-number-number-type-parameters.rs:10:17
|
LL | fn foo2(_: &dyn Zero<usize>) {
| ^^^^------- help: remove these generics
| ^^^^------- help: remove the unnecessary generics
| |
| expected 0 generic arguments
|
@ -36,7 +36,7 @@ error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplie
--> $DIR/unboxed-closure-sugar-wrong-number-number-type-parameters.rs:14:17
|
LL | fn foo3(_: &dyn Zero < usize >) {
| ^^^^-------------- help: remove these generics
| ^^^^-------------- help: remove the unnecessary generics
| |
| expected 0 generic arguments
|
@ -50,7 +50,7 @@ error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplie
--> $DIR/unboxed-closure-sugar-wrong-number-number-type-parameters.rs:18:17
|
LL | fn foo4(_: &dyn Zero(usize)) {
| ^^^^------- help: remove these parenthetical generics
| ^^^^------- help: remove the unnecessary parenthetical generics
| |
| expected 0 generic arguments
|
@ -70,7 +70,7 @@ error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplie
--> $DIR/unboxed-closure-sugar-wrong-number-number-type-parameters.rs:23:17
|
LL | fn foo5(_: &dyn Zero ( usize )) {
| ^^^^-------------- help: remove these parenthetical generics
| ^^^^-------------- help: remove the unnecessary parenthetical generics
| |
| expected 0 generic arguments
|

View File

@ -2,7 +2,7 @@ error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplie
--> $DIR/unboxed-closure-sugar-wrong-trait.rs:5:8
|
LL | fn f<F:Trait(isize) -> isize>(x: F) {}
| ^^^^^------- help: remove these parenthetical generics
| ^^^^^------- help: remove the unnecessary parenthetical generics
| |
| expected 0 generic arguments
|