Skip to content

Commit

Permalink
Revert suggestion verbosity change
Browse files Browse the repository at this point in the history
  • Loading branch information
estebank committed Jul 22, 2024
1 parent b30fdec commit 921de9d
Show file tree
Hide file tree
Showing 52 changed files with 402 additions and 811 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -954,7 +954,7 @@ impl<'a, 'tcx> WrongNumberOfGenericArgs<'a, 'tcx> {
let msg_lifetimes =
format!("remove the lifetime argument{s}", s = pluralize!(num_redundant_lt_args));

err.span_suggestion_verbose(
err.span_suggestion(
span_redundant_lt_args,
msg_lifetimes,
"",
Expand Down Expand Up @@ -1000,7 +1000,7 @@ impl<'a, 'tcx> WrongNumberOfGenericArgs<'a, 'tcx> {
s = pluralize!(num_redundant_gen_args),
);

err.span_suggestion_verbose(
err.span_suggestion(
span_redundant_type_or_const_args,
msg_types_or_consts,
"",
Expand Down Expand Up @@ -1050,7 +1050,7 @@ impl<'a, 'tcx> WrongNumberOfGenericArgs<'a, 'tcx> {
},
);

err.span_suggestion_verbose(span, msg, "", Applicability::MaybeIncorrect);
err.span_suggestion(span, msg, "", Applicability::MaybeIncorrect);
} else if redundant_lifetime_args && redundant_type_or_const_args {
remove_lifetime_args(err);
remove_type_or_const_args(err);
Expand Down
27 changes: 9 additions & 18 deletions tests/rustdoc-ui/invalid_const_in_lifetime_position.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,15 @@ 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 ()>>) {}
| ^ expected 0 generic arguments
| ^--- help: remove the unnecessary generics
| |
| expected 0 generic arguments
|
note: associated type defined here, with 0 generic parameters
--> $DIR/invalid_const_in_lifetime_position.rs:2:10
|
LL | type Y<'a>;
| ^
help: remove the unnecessary generics
|
LL - fn f<'a>(arg : Box<dyn X<Y<1> = &'a ()>>) {}
LL + fn f<'a>(arg : Box<dyn X<Y = &'a ()>>) {}
|

error[E0107]: associated type takes 1 lifetime argument but 0 lifetime arguments were supplied
--> $DIR/invalid_const_in_lifetime_position.rs:4:26
Expand All @@ -52,19 +49,16 @@ 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 ()>>) {}
| ^ expected 0 generic arguments
| ^--- help: remove the unnecessary generics
| |
| expected 0 generic arguments
|
note: associated type defined here, with 0 generic parameters
--> $DIR/invalid_const_in_lifetime_position.rs:2:10
|
LL | type Y<'a>;
| ^
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: remove the unnecessary generics
|
LL - fn f<'a>(arg : Box<dyn X<Y<1> = &'a ()>>) {}
LL + fn f<'a>(arg : Box<dyn X<Y = &'a ()>>) {}
|

error[E0107]: associated type takes 1 lifetime argument but 0 lifetime arguments were supplied
--> $DIR/invalid_const_in_lifetime_position.rs:4:26
Expand All @@ -87,19 +81,16 @@ 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 ()>>) {}
| ^ expected 0 generic arguments
| ^--- help: remove the unnecessary generics
| |
| expected 0 generic arguments
|
note: associated type defined here, with 0 generic parameters
--> $DIR/invalid_const_in_lifetime_position.rs:2:10
|
LL | type Y<'a>;
| ^
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: remove the unnecessary generics
|
LL - fn f<'a>(arg : Box<dyn X<Y<1> = &'a ()>>) {}
LL + fn f<'a>(arg : Box<dyn X<Y = &'a ()>>) {}
|

error[E0038]: the trait `X` cannot be made into an object
--> $DIR/invalid_const_in_lifetime_position.rs:4:20
Expand Down
9 changes: 3 additions & 6 deletions tests/rustdoc-ui/mismatched_arg_count.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,15 @@ 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>) {}
| ^^^^^ expected 1 lifetime argument
| ^^^^^ ---- help: remove the lifetime argument
| |
| expected 1 lifetime argument
|
note: type alias defined here, with 1 lifetime parameter: `'a`
--> $DIR/mismatched_arg_count.rs:5:6
|
LL | type Alias<'a, T> = <T as Trait<'a>>::Assoc;
| ^^^^^ --
help: remove the lifetime argument
|
LL - fn bar<'a, T: Trait<'a>>(_: Alias<'a, 'a, T>) {}
LL + fn bar<'a, T: Trait<'a>>(_: Alias<'a, T>) {}
|

error: aborting due to 1 previous error

Expand Down
9 changes: 3 additions & 6 deletions tests/ui/argument-suggestions/issue-100154.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,16 @@ error[E0107]: function takes 0 generic arguments but 1 generic argument was supp
--> $DIR/issue-100154.rs:4:5
|
LL | foo::<()>(());
| ^^^ expected 0 generic arguments
| ^^^------ help: remove the unnecessary generics
| |
| expected 0 generic arguments
|
note: function defined here, with 0 generic parameters
--> $DIR/issue-100154.rs:1:4
|
LL | fn foo(i: impl std::fmt::Display) {}
| ^^^
= note: `impl Trait` cannot be explicitly specified as a generic argument
help: remove the unnecessary generics
|
LL - foo::<()>(());
LL + foo(());
|

error[E0277]: `()` doesn't implement `std::fmt::Display`
--> $DIR/issue-100154.rs:4:11
Expand Down
18 changes: 6 additions & 12 deletions tests/ui/borrowck/issue-82126-mismatched-subst-and-hir.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,15 @@ 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<'_> {
| ^^^^^^^^^^^^ expected 0 lifetime arguments
| ^^^^^^^^^^^^---- help: remove the unnecessary generics
| |
| expected 0 lifetime arguments
|
note: struct defined here, with 0 lifetime parameters
--> $DIR/issue-82126-mismatched-subst-and-hir.rs:24:8
|
LL | struct LockedMarket<T>(T);
| ^^^^^^^^^^^^
help: remove the unnecessary generics
|
LL - async fn buy_lock(coroutine: &Mutex<MarketMultiplier>) -> LockedMarket<'_> {
LL + async fn buy_lock(coroutine: &Mutex<MarketMultiplier>) -> LockedMarket {
|

error[E0107]: struct takes 1 generic argument but 0 generic arguments were supplied
--> $DIR/issue-82126-mismatched-subst-and-hir.rs:16:59
Expand All @@ -35,19 +32,16 @@ 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<'_> {
| ^^^^^^^^^^^^ expected 0 lifetime arguments
| ^^^^^^^^^^^^---- help: remove the unnecessary generics
| |
| expected 0 lifetime arguments
|
note: struct defined here, with 0 lifetime parameters
--> $DIR/issue-82126-mismatched-subst-and-hir.rs:24:8
|
LL | struct LockedMarket<T>(T);
| ^^^^^^^^^^^^
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: remove the unnecessary generics
|
LL - async fn buy_lock(coroutine: &Mutex<MarketMultiplier>) -> LockedMarket<'_> {
LL + async fn buy_lock(coroutine: &Mutex<MarketMultiplier>) -> LockedMarket {
|

error[E0107]: struct takes 1 generic argument but 0 generic arguments were supplied
--> $DIR/issue-82126-mismatched-subst-and-hir.rs:16:59
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,9 @@ 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>,
| ^^^^^^^^^^^^^^^^^^^^^ expected at most 2 generic arguments
|
help: remove the unnecessary generic argument
|
LL - Dst: BikeshedIntrinsicFrom<Src, Context, ASSUME>,
LL + Dst: BikeshedIntrinsicFrom<Src, Context>,
|
| ^^^^^^^^^^^^^^^^^^^^^ -------- help: remove the unnecessary generic argument
| |
| expected at most 2 generic arguments

error[E0308]: mismatched types
--> $DIR/transmutable-ice-110969.rs:25:74
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,15 @@ error[E0107]: struct takes 2 generic arguments but 3 generic arguments were supp
--> $DIR/infer-arg-test.rs:18:10
|
LL | let a: All<_, _, _>;
| ^^^ expected 2 generic arguments
| ^^^ --- help: remove the unnecessary generic argument
| |
| expected 2 generic arguments
|
note: struct defined here, with 2 generic parameters: `T`, `N`
--> $DIR/infer-arg-test.rs:3:8
|
LL | struct All<'a, T, const N: usize> {
| ^^^ - --------------
help: remove the unnecessary generic argument
|
LL - let a: All<_, _, _>;
LL + let a: All<_, _>;
|

error: aborting due to 4 previous errors

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,15 @@ 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]);
| ^^^ expected 1 generic argument
| ^^^ --- help: remove the unnecessary generic argument
| |
| expected 1 generic argument
|
note: function defined here, with 1 generic parameter: `N`
--> $DIR/issue_114151.rs:4:4
|
LL | fn foo<const N: usize>(
| ^^^ --------------
help: remove the unnecessary generic argument
|
LL - foo::<_, L>([(); L + 1 + L]);
LL + foo::<_>([(); L + 1 + L]);
|

error[E0308]: mismatched types
--> $DIR/issue_114151.rs:17:18
Expand Down
27 changes: 9 additions & 18 deletions tests/ui/const-generics/generic_const_exprs/issue-102768.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,15 @@ 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 ()>>) {}
| ^ expected 0 generic arguments
| ^--- help: remove the unnecessary generics
| |
| expected 0 generic arguments
|
note: associated type defined here, with 0 generic parameters
--> $DIR/issue-102768.rs:5:10
|
LL | type Y<'a>;
| ^
help: remove the unnecessary generics
|
LL - fn f2<'a>(arg: Box<dyn X<Y<1> = &'a ()>>) {}
LL + fn f2<'a>(arg: Box<dyn X<Y = &'a ()>>) {}
|

error[E0107]: associated type takes 1 lifetime argument but 0 lifetime arguments were supplied
--> $DIR/issue-102768.rs:9:30
Expand All @@ -52,19 +49,16 @@ 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 ()>>) {}
| ^ expected 0 generic arguments
| ^--- help: remove the unnecessary generics
| |
| expected 0 generic arguments
|
note: associated type defined here, with 0 generic parameters
--> $DIR/issue-102768.rs:5:10
|
LL | type Y<'a>;
| ^
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: remove the unnecessary generics
|
LL - fn f2<'a>(arg: Box<dyn X<Y<1> = &'a ()>>) {}
LL + fn f2<'a>(arg: Box<dyn X<Y = &'a ()>>) {}
|

error[E0107]: associated type takes 1 lifetime argument but 0 lifetime arguments were supplied
--> $DIR/issue-102768.rs:9:30
Expand All @@ -87,19 +81,16 @@ 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 ()>>) {}
| ^ expected 0 generic arguments
| ^--- help: remove the unnecessary generics
| |
| expected 0 generic arguments
|
note: associated type defined here, with 0 generic parameters
--> $DIR/issue-102768.rs:5:10
|
LL | type Y<'a>;
| ^
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: remove the unnecessary generics
|
LL - fn f2<'a>(arg: Box<dyn X<Y<1> = &'a ()>>) {}
LL + fn f2<'a>(arg: Box<dyn X<Y = &'a ()>>) {}
|

error[E0038]: the trait `X` cannot be made into an object
--> $DIR/issue-102768.rs:9:24
Expand Down
9 changes: 3 additions & 6 deletions tests/ui/const-generics/incorrect-number-of-const-args.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,15 @@ 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>();
| ^^^ expected 2 generic arguments
| ^^^ --- help: remove the unnecessary generic argument
| |
| expected 2 generic arguments
|
note: function defined here, with 2 generic parameters: `X`, `Y`
--> $DIR/incorrect-number-of-const-args.rs:1:4
|
LL | fn foo<const X: usize, const Y: usize>() -> usize {
| ^^^ -------------- --------------
help: remove the unnecessary generic argument
|
LL - foo::<0, 0, 0>();
LL + foo::<0, 0>();
|

error: aborting due to 2 previous errors

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,15 @@ 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>;
| ^ expected 0 generic arguments
| ^----- help: remove the unnecessary generics
| |
| expected 0 generic arguments
|
note: struct defined here, with 0 generic parameters
--> $DIR/invalid-const-arg-for-type-param.rs:3:8
|
LL | struct S;
| ^
help: remove the unnecessary generics
|
LL - S::<0>;
LL + S;
|

error: aborting due to 3 previous errors

Expand Down
10 changes: 3 additions & 7 deletions tests/ui/const-generics/invalid-constant-in-args.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,9 @@ 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("");
| ^^^^ expected 1 generic argument
|
help: remove the unnecessary generic argument
|
LL - let _: Cell<&str, "a"> = Cell::new("");
LL + let _: Cell<&str> = Cell::new("");
|
| ^^^^ ----- help: remove the unnecessary generic argument
| |
| expected 1 generic argument

error: aborting due to 1 previous error

Expand Down
Loading

0 comments on commit 921de9d

Please sign in to comment.