about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEsteban Küber <esteban@kuber.com.ar>2024-07-05 17:24:23 +0000
committerEsteban Küber <esteban@kuber.com.ar>2024-07-22 22:04:49 +0000
commitb30fdec5fb283641fc0452fa6ca60193a16bb30d (patch)
treec360a87a4f13502e1e033c9ae1a545d07be73fcc
parent5c2b36a21cabafb1f08e278f4c6ed61753a654cf (diff)
downloadrust-b30fdec5fb283641fc0452fa6ca60193a16bb30d.tar.gz
rust-b30fdec5fb283641fc0452fa6ca60193a16bb30d.zip
On generic and lifetime removal suggestion, do not leave behind stray `,`
-rw-r--r--compiler/rustc_hir_analysis/src/errors/wrong_number_of_generic_args.rs26
-rw-r--r--tests/rustdoc-ui/mismatched_arg_count.stderr2
-rw-r--r--tests/ui/const-generics/adt_const_params/transmutable-ice-110969.stderr2
-rw-r--r--tests/ui/const-generics/generic_arg_infer/infer-arg-test.stderr2
-rw-r--r--tests/ui/const-generics/generic_const_exprs/const_kind_expr/issue_114151.stderr2
-rw-r--r--tests/ui/const-generics/incorrect-number-of-const-args.stderr2
-rw-r--r--tests/ui/const-generics/invalid-constant-in-args.stderr2
-rw-r--r--tests/ui/constructor-lifetime-args.stderr4
-rw-r--r--tests/ui/error-codes/E0107.stderr12
-rw-r--r--tests/ui/generic-associated-types/parameter_number_and_kind.stderr4
-rw-r--r--tests/ui/generics/bad-mid-path-type-params.stderr6
-rw-r--r--tests/ui/generics/foreign-generic-mismatch.stderr2
-rw-r--r--tests/ui/generics/generic-arg-mismatch-recover.stderr4
-rw-r--r--tests/ui/generics/generic-impl-more-params-with-defaults.stderr2
-rw-r--r--tests/ui/generics/generic-type-more-params-with-defaults.stderr2
-rw-r--r--tests/ui/generics/wrong-number-of-args.stderr36
-rw-r--r--tests/ui/impl-trait/explicit-generic-args-with-impl-trait/explicit-generic-args-for-impl.stderr2
-rw-r--r--tests/ui/late-bound-lifetimes/mismatched_arg_count.stderr2
-rw-r--r--tests/ui/lifetimes/noisy-follow-up-erro.stderr2
-rw-r--r--tests/ui/methods/method-call-lifetime-args-fail.stderr4
-rw-r--r--tests/ui/traits/associated_type_bound/116464-invalid-assoc-type-suggestion-in-trait-impl.stderr2
-rw-r--r--tests/ui/traits/object/vs-lifetime.stderr2
-rw-r--r--tests/ui/traits/test-2.stderr2
-rw-r--r--tests/ui/transmutability/issue-101739-2.stderr3
-rw-r--r--tests/ui/typeck/typeck_type_placeholder_lifetime_1.stderr2
-rw-r--r--tests/ui/typeck/typeck_type_placeholder_lifetime_2.stderr2
26 files changed, 71 insertions, 62 deletions
diff --git a/compiler/rustc_hir_analysis/src/errors/wrong_number_of_generic_args.rs b/compiler/rustc_hir_analysis/src/errors/wrong_number_of_generic_args.rs
index 6c2ec1acdf9..7443070b9de 100644
--- a/compiler/rustc_hir_analysis/src/errors/wrong_number_of_generic_args.rs
+++ b/compiler/rustc_hir_analysis/src/errors/wrong_number_of_generic_args.rs
@@ -939,17 +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 the lifetime argument{s}",
-                s = pluralize!(num_redundant_lt_args),
-            );
+            let msg_lifetimes =
+                format!("remove the lifetime argument{s}", s = pluralize!(num_redundant_lt_args));
 
             err.span_suggestion_verbose(
                 span_redundant_lt_args,
@@ -978,11 +981,16 @@ 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 =
diff --git a/tests/rustdoc-ui/mismatched_arg_count.stderr b/tests/rustdoc-ui/mismatched_arg_count.stderr
index 8e7def04f52..9a698d8f5ad 100644
--- a/tests/rustdoc-ui/mismatched_arg_count.stderr
+++ b/tests/rustdoc-ui/mismatched_arg_count.stderr
@@ -12,7 +12,7 @@ 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>) {}
+LL + fn bar<'a, T: Trait<'a>>(_: Alias<'a, T>) {}
    |
 
 error: aborting due to 1 previous error
diff --git a/tests/ui/const-generics/adt_const_params/transmutable-ice-110969.stderr b/tests/ui/const-generics/adt_const_params/transmutable-ice-110969.stderr
index 3f32b0eb674..ceac2c95bfa 100644
--- a/tests/ui/const-generics/adt_const_params/transmutable-ice-110969.stderr
+++ b/tests/ui/const-generics/adt_const_params/transmutable-ice-110969.stderr
@@ -7,7 +7,7 @@ LL |         Dst: BikeshedIntrinsicFrom<Src, Context, ASSUME>,
 help: remove the unnecessary generic argument
    |
 LL -         Dst: BikeshedIntrinsicFrom<Src, Context, ASSUME>,
-LL +         Dst: BikeshedIntrinsicFrom<Src, Context, >,
+LL +         Dst: BikeshedIntrinsicFrom<Src, Context>,
    |
 
 error[E0308]: mismatched types
diff --git a/tests/ui/const-generics/generic_arg_infer/infer-arg-test.stderr b/tests/ui/const-generics/generic_arg_infer/infer-arg-test.stderr
index d8e794a7a65..61688f3acab 100644
--- a/tests/ui/const-generics/generic_arg_infer/infer-arg-test.stderr
+++ b/tests/ui/const-generics/generic_arg_infer/infer-arg-test.stderr
@@ -33,7 +33,7 @@ LL | struct All<'a, T, const N: usize> {
 help: remove the unnecessary generic argument
    |
 LL -   let a: All<_, _, _>;
-LL +   let a: All<_, _, >;
+LL +   let a: All<_, _>;
    |
 
 error: aborting due to 4 previous errors
diff --git a/tests/ui/const-generics/generic_const_exprs/const_kind_expr/issue_114151.stderr b/tests/ui/const-generics/generic_const_exprs/const_kind_expr/issue_114151.stderr
index a7232ef780e..c66f351ea7f 100644
--- a/tests/ui/const-generics/generic_const_exprs/const_kind_expr/issue_114151.stderr
+++ b/tests/ui/const-generics/generic_const_exprs/const_kind_expr/issue_114151.stderr
@@ -12,7 +12,7 @@ LL | fn foo<const N: usize>(
 help: remove the unnecessary generic argument
    |
 LL -     foo::<_, L>([(); L + 1 + L]);
-LL +     foo::<_, >([(); L + 1 + L]);
+LL +     foo::<_>([(); L + 1 + L]);
    |
 
 error[E0308]: mismatched types
diff --git a/tests/ui/const-generics/incorrect-number-of-const-args.stderr b/tests/ui/const-generics/incorrect-number-of-const-args.stderr
index 05c4a0a1a72..f670ebc8ab0 100644
--- a/tests/ui/const-generics/incorrect-number-of-const-args.stderr
+++ b/tests/ui/const-generics/incorrect-number-of-const-args.stderr
@@ -30,7 +30,7 @@ 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, >();
+LL +     foo::<0, 0>();
    |
 
 error: aborting due to 2 previous errors
diff --git a/tests/ui/const-generics/invalid-constant-in-args.stderr b/tests/ui/const-generics/invalid-constant-in-args.stderr
index 10334e0d896..c3a3f251d46 100644
--- a/tests/ui/const-generics/invalid-constant-in-args.stderr
+++ b/tests/ui/const-generics/invalid-constant-in-args.stderr
@@ -7,7 +7,7 @@ LL |     let _: Cell<&str, "a"> = Cell::new("");
 help: remove the unnecessary generic argument
    |
 LL -     let _: Cell<&str, "a"> = Cell::new("");
-LL +     let _: Cell<&str, > = Cell::new("");
+LL +     let _: Cell<&str> = Cell::new("");
    |
 
 error: aborting due to 1 previous error
diff --git a/tests/ui/constructor-lifetime-args.stderr b/tests/ui/constructor-lifetime-args.stderr
index 37b13cd048f..980a812e3b4 100644
--- a/tests/ui/constructor-lifetime-args.stderr
+++ b/tests/ui/constructor-lifetime-args.stderr
@@ -30,7 +30,7 @@ LL | struct S<'a, 'b>(&'a u8, &'b u8);
 help: remove the lifetime argument
    |
 LL -     S::<'static, 'static, 'static>(&0, &0);
-LL +     S::<'static, 'static, >(&0, &0);
+LL +     S::<'static, 'static>(&0, &0);
    |
 
 error[E0107]: enum takes 2 lifetime arguments but 1 lifetime argument was supplied
@@ -65,7 +65,7 @@ LL | enum E<'a, 'b> {
 help: remove the lifetime argument
    |
 LL -     E::V::<'static, 'static, 'static>(&0);
-LL +     E::V::<'static, 'static, >(&0);
+LL +     E::V::<'static, 'static>(&0);
    |
 
 error: aborting due to 4 previous errors
diff --git a/tests/ui/error-codes/E0107.stderr b/tests/ui/error-codes/E0107.stderr
index d8bd96e0ad4..3271abd8a79 100644
--- a/tests/ui/error-codes/E0107.stderr
+++ b/tests/ui/error-codes/E0107.stderr
@@ -47,7 +47,7 @@ LL | struct Foo<'a>(&'a str);
 help: remove the lifetime arguments
    |
 LL -     foo2: Foo<'a, 'b, 'c>,
-LL +     foo2: Foo<'a, >,
+LL +     foo2: Foo<'a>,
    |
 
 error[E0107]: struct takes 1 lifetime argument but 2 lifetime arguments were supplied
@@ -64,7 +64,7 @@ LL | struct Qux<'a, T>(&'a T);
 help: remove the lifetime argument
    |
 LL -     qux1: Qux<'a, 'b, i32>,
-LL +     qux1: Qux<'a, , i32>,
+LL +     qux1: Qux<'a, i32>,
    |
 
 error[E0107]: struct takes 1 lifetime argument but 2 lifetime arguments were supplied
@@ -81,7 +81,7 @@ LL | struct Qux<'a, T>(&'a T);
 help: remove the lifetime argument
    |
 LL -     qux2: Qux<'a, i32, 'b>,
-LL +     qux2: Qux<'a, i32, >,
+LL +     qux2: Qux<'a>,
    |
 
 error[E0107]: struct takes 1 lifetime argument but 3 lifetime arguments were supplied
@@ -98,7 +98,7 @@ LL | struct Qux<'a, T>(&'a T);
 help: remove the lifetime arguments
    |
 LL -     qux3: Qux<'a, 'b, 'c, i32>,
-LL +     qux3: Qux<'a, , i32>,
+LL +     qux3: Qux<'a, i32>,
    |
 
 error[E0107]: struct takes 1 lifetime argument but 3 lifetime arguments were supplied
@@ -115,7 +115,7 @@ LL | struct Qux<'a, T>(&'a T);
 help: remove the lifetime arguments
    |
 LL -     qux4: Qux<'a, i32, 'b, 'c>,
-LL +     qux4: Qux<'a, i32, >,
+LL +     qux4: Qux<'a>,
    |
 
 error[E0107]: struct takes 1 lifetime argument but 3 lifetime arguments were supplied
@@ -132,7 +132,7 @@ LL | struct Qux<'a, T>(&'a T);
 help: remove the lifetime argument
    |
 LL -     qux5: Qux<'a, 'b, i32, 'c>,
-LL +     qux5: Qux<'a, , i32, 'c>,
+LL +     qux5: Qux<'a, i32, 'c>,
    |
 
 error[E0107]: struct takes 0 lifetime arguments but 2 lifetime arguments were supplied
diff --git a/tests/ui/generic-associated-types/parameter_number_and_kind.stderr b/tests/ui/generic-associated-types/parameter_number_and_kind.stderr
index 7b7f21b00c5..1c9351cb351 100644
--- a/tests/ui/generic-associated-types/parameter_number_and_kind.stderr
+++ b/tests/ui/generic-associated-types/parameter_number_and_kind.stderr
@@ -12,7 +12,7 @@ LL |     type E<'a, T>;
 help: remove the lifetime argument
    |
 LL -     type FErr1 = Self::E<'static, 'static>;
-LL +     type FErr1 = Self::E<'static, >;
+LL +     type FErr1 = Self::E<'static>;
    |
 
 error[E0107]: associated type takes 1 generic argument but 0 generic arguments were supplied
@@ -45,7 +45,7 @@ LL |     type E<'a, T>;
 help: remove the unnecessary generic argument
    |
 LL -     type FErr2<T> = Self::E<'static, T, u32>;
-LL +     type FErr2<T> = Self::E<'static, T, >;
+LL +     type FErr2<T> = Self::E<'static, T>;
    |
 
 error: aborting due to 3 previous errors
diff --git a/tests/ui/generics/bad-mid-path-type-params.stderr b/tests/ui/generics/bad-mid-path-type-params.stderr
index ba1d48f1210..cff5464dce4 100644
--- a/tests/ui/generics/bad-mid-path-type-params.stderr
+++ b/tests/ui/generics/bad-mid-path-type-params.stderr
@@ -12,7 +12,7 @@ LL |     fn new<U>(x: T, _: U) -> S<T> {
 help: remove the unnecessary generic argument
    |
 LL -     let _ = S::new::<isize,f64>(1, 1.0);
-LL +     let _ = S::new::<isize,>(1, 1.0);
+LL +     let _ = S::new::<isize>(1, 1.0);
    |
 
 error[E0107]: struct takes 0 lifetime arguments but 1 lifetime argument was supplied
@@ -46,7 +46,7 @@ LL |     fn new<U>(x: T, y: U) -> Self;
 help: remove the unnecessary generic argument
    |
 LL -     let _: S2 = Trait::new::<isize,f64>(1, 1.0);
-LL +     let _: S2 = Trait::new::<isize,>(1, 1.0);
+LL +     let _: S2 = Trait::new::<isize>(1, 1.0);
    |
 
 error[E0107]: trait takes 0 lifetime arguments but 1 lifetime argument was supplied
@@ -80,7 +80,7 @@ LL |     fn new<U>(x: T, y: U) -> Self;
 help: remove the unnecessary generic argument
    |
 LL -     let _: S2 = Trait::<'a,isize>::new::<f64,f64>(1, 1.0);
-LL +     let _: S2 = Trait::<'a,isize>::new::<f64,>(1, 1.0);
+LL +     let _: S2 = Trait::<'a,isize>::new::<f64>(1, 1.0);
    |
 
 error: aborting due to 5 previous errors
diff --git a/tests/ui/generics/foreign-generic-mismatch.stderr b/tests/ui/generics/foreign-generic-mismatch.stderr
index 740963aeec5..4cf76cde920 100644
--- a/tests/ui/generics/foreign-generic-mismatch.stderr
+++ b/tests/ui/generics/foreign-generic-mismatch.stderr
@@ -30,7 +30,7 @@ LL | pub fn lt_arg<'a: 'a>() {}
 help: remove the lifetime argument
    |
 LL -     foreign_generic_mismatch::lt_arg::<'static, 'static>();
-LL +     foreign_generic_mismatch::lt_arg::<'static, >();
+LL +     foreign_generic_mismatch::lt_arg::<'static>();
    |
 
 error: aborting due to 2 previous errors
diff --git a/tests/ui/generics/generic-arg-mismatch-recover.stderr b/tests/ui/generics/generic-arg-mismatch-recover.stderr
index e8c2a4665f3..d2953e37c8c 100644
--- a/tests/ui/generics/generic-arg-mismatch-recover.stderr
+++ b/tests/ui/generics/generic-arg-mismatch-recover.stderr
@@ -12,7 +12,7 @@ LL | struct Foo<'a, T: 'a>(&'a T);
 help: remove the lifetime argument
    |
 LL -     Foo::<'static, 'static, ()>(&0);
-LL +     Foo::<'static, , ()>(&0);
+LL +     Foo::<'static, ()>(&0);
    |
 
 error[E0107]: struct takes 1 lifetime argument but 2 lifetime arguments were supplied
@@ -29,7 +29,7 @@ LL | struct Bar<'a>(&'a ());
 help: remove the lifetime argument
    |
 LL -     Bar::<'static, 'static, ()>(&());
-LL +     Bar::<'static, , ()>(&());
+LL +     Bar::<'static, ()>(&());
    |
 
 error[E0107]: struct takes 0 generic arguments but 1 generic argument was supplied
diff --git a/tests/ui/generics/generic-impl-more-params-with-defaults.stderr b/tests/ui/generics/generic-impl-more-params-with-defaults.stderr
index b0973c477ff..a180e348a68 100644
--- a/tests/ui/generics/generic-impl-more-params-with-defaults.stderr
+++ b/tests/ui/generics/generic-impl-more-params-with-defaults.stderr
@@ -12,7 +12,7 @@ LL | struct Vec<T, A = Heap>(
 help: remove the unnecessary generic argument
    |
 LL -     Vec::<isize, Heap, bool>::new();
-LL +     Vec::<isize, Heap, >::new();
+LL +     Vec::<isize, Heap>::new();
    |
 
 error: aborting due to 1 previous error
diff --git a/tests/ui/generics/generic-type-more-params-with-defaults.stderr b/tests/ui/generics/generic-type-more-params-with-defaults.stderr
index e83a433b060..9b73b7375d7 100644
--- a/tests/ui/generics/generic-type-more-params-with-defaults.stderr
+++ b/tests/ui/generics/generic-type-more-params-with-defaults.stderr
@@ -12,7 +12,7 @@ LL | struct Vec<T, A = Heap>(
 help: remove the unnecessary generic argument
    |
 LL -     let _: Vec<isize, Heap, bool>;
-LL +     let _: Vec<isize, Heap, >;
+LL +     let _: Vec<isize, Heap>;
    |
 
 error: aborting due to 1 previous error
diff --git a/tests/ui/generics/wrong-number-of-args.stderr b/tests/ui/generics/wrong-number-of-args.stderr
index 1363032ad14..17503b86e19 100644
--- a/tests/ui/generics/wrong-number-of-args.stderr
+++ b/tests/ui/generics/wrong-number-of-args.stderr
@@ -249,7 +249,7 @@ LL |     struct Ty;
 help: remove the unnecessary generic arguments
    |
 LL -     type D = Ty<'static, usize, { 0 }>;
-LL +     type D = Ty<'static, >;
+LL +     type D = Ty<'static, usize>;
    |
 
 error[E0107]: missing generics for struct `type_and_type::Ty`
@@ -300,7 +300,7 @@ LL |     struct Ty<A, B>(A, B);
 help: remove the unnecessary generic argument
    |
 LL -     type D = Ty<usize, String, char>;
-LL +     type D = Ty<usize, String, >;
+LL +     type D = Ty<usize, String>;
    |
 
 error[E0107]: struct takes 2 generic arguments but 0 generic arguments were supplied
@@ -381,7 +381,7 @@ LL |     struct Ty<'a, T>(&'a T);
 help: remove the lifetime argument
    |
 LL -     type F = Ty<'static, usize, 'static, usize>;
-LL +     type F = Ty<'static, usize, , usize>;
+LL +     type F = Ty<'static, usize>;
    |
 
 error[E0107]: struct takes 1 generic argument but 2 generic arguments were supplied
@@ -398,7 +398,7 @@ LL |     struct Ty<'a, T>(&'a T);
 help: remove the unnecessary generic argument
    |
 LL -     type F = Ty<'static, usize, 'static, usize>;
-LL +     type F = Ty<'static, usize, 'static, >;
+LL +     type F = Ty<'static, usize>;
    |
 
 error[E0107]: missing generics for struct `type_and_type_and_type::Ty`
@@ -449,7 +449,7 @@ LL |     struct Ty<A, B, C = &'static str>(A, B, C);
 help: remove the unnecessary generic argument
    |
 LL -     type E = Ty<usize, String, char, f64>;
-LL +     type E = Ty<usize, String, char, >;
+LL +     type E = Ty<usize, String, char>;
    |
 
 error[E0107]: struct takes at least 2 generic arguments but 0 generic arguments were supplied
@@ -499,7 +499,7 @@ LL |     trait GenericLifetime<'a> {
 help: remove the lifetime argument
    |
 LL -     type C = Box<dyn GenericLifetime<'static, 'static>>;
-LL +     type C = Box<dyn GenericLifetime<'static, >>;
+LL +     type C = Box<dyn GenericLifetime<'static>>;
    |
 
 error[E0107]: missing generics for trait `GenericType`
@@ -532,7 +532,7 @@ LL |     trait GenericType<A> {
 help: remove the unnecessary generic argument
    |
 LL -     type E = Box<dyn GenericType<String, usize>>;
-LL +     type E = Box<dyn GenericType<String, >>;
+LL +     type E = Box<dyn GenericType<String>>;
    |
 
 error[E0107]: trait takes 1 generic argument but 0 generic arguments were supplied
@@ -582,7 +582,7 @@ LL |         trait GenericLifetimeAT<'a> {
 help: remove the lifetime argument
    |
 LL -         type B = Box<dyn GenericLifetimeAT<'static, 'static, AssocTy=()>>;
-LL +         type B = Box<dyn GenericLifetimeAT<'static, , AssocTy=()>>;
+LL +         type B = Box<dyn GenericLifetimeAT<'static, AssocTy=()>>;
    |
 
 error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplied
@@ -632,7 +632,7 @@ LL |         trait GenericTypeAT<A> {
 help: remove the unnecessary generic argument
    |
 LL -         type B = Box<dyn GenericTypeAT<(), (), AssocTy=()>>;
-LL +         type B = Box<dyn GenericTypeAT<(), , AssocTy=()>>;
+LL +         type B = Box<dyn GenericTypeAT<(), AssocTy=()>>;
    |
 
 error[E0107]: trait takes 0 lifetime arguments but 1 lifetime argument was supplied
@@ -714,7 +714,7 @@ LL |         trait GenericLifetimeTypeAT<'a, A> {
 help: remove the lifetime argument
    |
 LL -         type C = Box<dyn GenericLifetimeTypeAT<'static, 'static, AssocTy=()>>;
-LL +         type C = Box<dyn GenericLifetimeTypeAT<'static, , AssocTy=()>>;
+LL +         type C = Box<dyn GenericLifetimeTypeAT<'static, AssocTy=()>>;
    |
 
 error[E0107]: trait takes 1 generic argument but 0 generic arguments were supplied
@@ -747,7 +747,7 @@ LL |         trait GenericLifetimeTypeAT<'a, A> {
 help: remove the unnecessary generic argument
    |
 LL -         type E = Box<dyn GenericLifetimeTypeAT<(), (), AssocTy=()>>;
-LL +         type E = Box<dyn GenericLifetimeTypeAT<(), , AssocTy=()>>;
+LL +         type E = Box<dyn GenericLifetimeTypeAT<(), AssocTy=()>>;
    |
 
 error[E0107]: trait takes 1 lifetime argument but 2 lifetime arguments were supplied
@@ -764,7 +764,7 @@ LL |         trait GenericLifetimeTypeAT<'a, A> {
 help: remove the lifetime argument
    |
 LL -         type F = Box<dyn GenericLifetimeTypeAT<'static, 'static, (), AssocTy=()>>;
-LL +         type F = Box<dyn GenericLifetimeTypeAT<'static, , (), AssocTy=()>>;
+LL +         type F = Box<dyn GenericLifetimeTypeAT<'static, (), AssocTy=()>>;
    |
 
 error[E0107]: trait takes 1 generic argument but 2 generic arguments were supplied
@@ -781,7 +781,7 @@ LL |         trait GenericLifetimeTypeAT<'a, A> {
 help: remove the unnecessary generic argument
    |
 LL -         type G = Box<dyn GenericLifetimeTypeAT<'static, (), (), AssocTy=()>>;
-LL +         type G = Box<dyn GenericLifetimeTypeAT<'static, (), , AssocTy=()>>;
+LL +         type G = Box<dyn GenericLifetimeTypeAT<'static, (), AssocTy=()>>;
    |
 
 error[E0107]: trait takes 1 lifetime argument but 2 lifetime arguments were supplied
@@ -798,7 +798,7 @@ LL |         trait GenericLifetimeTypeAT<'a, A> {
 help: remove the lifetime argument
    |
 LL -         type H = Box<dyn GenericLifetimeTypeAT<'static, 'static, (), (), AssocTy=()>>;
-LL +         type H = Box<dyn GenericLifetimeTypeAT<'static, , (), (), AssocTy=()>>;
+LL +         type H = Box<dyn GenericLifetimeTypeAT<'static, (), (), AssocTy=()>>;
    |
 
 error[E0107]: trait takes 1 generic argument but 2 generic arguments were supplied
@@ -815,7 +815,7 @@ LL |         trait GenericLifetimeTypeAT<'a, A> {
 help: remove the unnecessary generic argument
    |
 LL -         type H = Box<dyn GenericLifetimeTypeAT<'static, 'static, (), (), AssocTy=()>>;
-LL +         type H = Box<dyn GenericLifetimeTypeAT<'static, 'static, (), , AssocTy=()>>;
+LL +         type H = Box<dyn GenericLifetimeTypeAT<'static, 'static, (), AssocTy=()>>;
    |
 
 error[E0107]: trait takes 2 generic arguments but 0 generic arguments were supplied
@@ -866,7 +866,7 @@ LL |         trait GenericTypeTypeAT<A, B> {
 help: remove the unnecessary generic argument
    |
 LL -         type C = Box<dyn GenericTypeTypeAT<(), (), (), AssocTy=()>>;
-LL +         type C = Box<dyn GenericTypeTypeAT<(), (), , AssocTy=()>>;
+LL +         type C = Box<dyn GenericTypeTypeAT<(), (), AssocTy=()>>;
    |
 
 error[E0107]: trait takes 2 lifetime arguments but 1 lifetime argument was supplied
@@ -1011,7 +1011,7 @@ LL |         type D = HashMap<usize, String, char, f64>;
 help: remove the unnecessary generic argument
    |
 LL -         type D = HashMap<usize, String, char, f64>;
-LL +         type D = HashMap<usize, String, char, >;
+LL +         type D = HashMap<usize, String, char>;
    |
 
 error[E0107]: struct takes at least 2 generic arguments but 0 generic arguments were supplied
@@ -1081,7 +1081,7 @@ LL |         type D = Result<usize, String, char>;
 help: remove the unnecessary generic argument
    |
 LL -         type D = Result<usize, String, char>;
-LL +         type D = Result<usize, String, >;
+LL +         type D = Result<usize, String>;
    |
 
 error[E0107]: enum takes 2 generic arguments but 0 generic arguments were supplied
diff --git a/tests/ui/impl-trait/explicit-generic-args-with-impl-trait/explicit-generic-args-for-impl.stderr b/tests/ui/impl-trait/explicit-generic-args-with-impl-trait/explicit-generic-args-for-impl.stderr
index 1c22e77e817..e225d7076b8 100644
--- a/tests/ui/impl-trait/explicit-generic-args-with-impl-trait/explicit-generic-args-for-impl.stderr
+++ b/tests/ui/impl-trait/explicit-generic-args-with-impl-trait/explicit-generic-args-for-impl.stderr
@@ -13,7 +13,7 @@ LL | fn foo<T: ?Sized>(_f: impl AsRef<T>) {}
 help: remove the unnecessary generic argument
    |
 LL -     foo::<str, String>("".to_string());
-LL +     foo::<str, >("".to_string());
+LL +     foo::<str>("".to_string());
    |
 
 error: aborting due to 1 previous error
diff --git a/tests/ui/late-bound-lifetimes/mismatched_arg_count.stderr b/tests/ui/late-bound-lifetimes/mismatched_arg_count.stderr
index 02dbfca15a4..c0a5b62a56a 100644
--- a/tests/ui/late-bound-lifetimes/mismatched_arg_count.stderr
+++ b/tests/ui/late-bound-lifetimes/mismatched_arg_count.stderr
@@ -12,7 +12,7 @@ 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>) {}
+LL + fn bar<'a, T: Trait<'a>>(_: Alias<'a, T>) {}
    |
 
 error: aborting due to 1 previous error
diff --git a/tests/ui/lifetimes/noisy-follow-up-erro.stderr b/tests/ui/lifetimes/noisy-follow-up-erro.stderr
index 90dfc88e19f..3c2d0df683a 100644
--- a/tests/ui/lifetimes/noisy-follow-up-erro.stderr
+++ b/tests/ui/lifetimes/noisy-follow-up-erro.stderr
@@ -12,7 +12,7 @@ LL | struct Foo<'c, 'd>(&'c (), &'d ());
 help: remove the lifetime argument
    |
 LL -     fn boom(&self, foo: &mut Foo<'_, '_, 'a>) -> Result<(), &'a ()> {
-LL +     fn boom(&self, foo: &mut Foo<'_, '_, >) -> Result<(), &'a ()> {
+LL +     fn boom(&self, foo: &mut Foo<'_, '_>) -> Result<(), &'a ()> {
    |
 
 error[E0621]: explicit lifetime required in the type of `foo`
diff --git a/tests/ui/methods/method-call-lifetime-args-fail.stderr b/tests/ui/methods/method-call-lifetime-args-fail.stderr
index 60ef1060aac..2eda01fa20c 100644
--- a/tests/ui/methods/method-call-lifetime-args-fail.stderr
+++ b/tests/ui/methods/method-call-lifetime-args-fail.stderr
@@ -30,7 +30,7 @@ LL |     fn early<'a, 'b>(self) -> (&'a u8, &'b u8) { loop {} }
 help: remove the lifetime argument
    |
 LL -     S.early::<'static, 'static, 'static>();
-LL +     S.early::<'static, 'static, >();
+LL +     S.early::<'static, 'static>();
    |
 
 error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present
@@ -233,7 +233,7 @@ LL |     fn early<'a, 'b>(self) -> (&'a u8, &'b u8) { loop {} }
 help: remove the lifetime argument
    |
 LL -     S::early::<'static, 'static, 'static>(S);
-LL +     S::early::<'static, 'static, >(S);
+LL +     S::early::<'static, 'static>(S);
    |
 
 error: aborting due to 18 previous errors
diff --git a/tests/ui/traits/associated_type_bound/116464-invalid-assoc-type-suggestion-in-trait-impl.stderr b/tests/ui/traits/associated_type_bound/116464-invalid-assoc-type-suggestion-in-trait-impl.stderr
index 5a54ca181ce..d25192b3d6d 100644
--- a/tests/ui/traits/associated_type_bound/116464-invalid-assoc-type-suggestion-in-trait-impl.stderr
+++ b/tests/ui/traits/associated_type_bound/116464-invalid-assoc-type-suggestion-in-trait-impl.stderr
@@ -127,7 +127,7 @@ LL | struct Struct<T: Trait<u32, String>> {
 help: remove the unnecessary generic argument
    |
 LL - impl<T: Trait<u32, Assoc=String>, U> YetAnotherTrait for Struct<T, U> {}
-LL + impl<T: Trait<u32, Assoc=String>, U> YetAnotherTrait for Struct<T, > {}
+LL + impl<T: Trait<u32, Assoc=String>, U> YetAnotherTrait for Struct<T> {}
    |
 
 error: aborting due to 9 previous errors
diff --git a/tests/ui/traits/object/vs-lifetime.stderr b/tests/ui/traits/object/vs-lifetime.stderr
index e02c750055b..889e1e82876 100644
--- a/tests/ui/traits/object/vs-lifetime.stderr
+++ b/tests/ui/traits/object/vs-lifetime.stderr
@@ -18,7 +18,7 @@ LL | struct S<'a, T>(&'a u8, T);
 help: remove the lifetime argument
    |
 LL -     let _: S<'static, 'static>;
-LL +     let _: S<'static, >;
+LL +     let _: S<'static>;
    |
 
 error[E0107]: struct takes 1 generic argument but 0 generic arguments were supplied
diff --git a/tests/ui/traits/test-2.stderr b/tests/ui/traits/test-2.stderr
index d1a003aa3f4..d64497309ef 100644
--- a/tests/ui/traits/test-2.stderr
+++ b/tests/ui/traits/test-2.stderr
@@ -29,7 +29,7 @@ LL | trait bar { fn dup(&self) -> Self; fn blah<X>(&self); }
 help: remove the unnecessary generic argument
    |
 LL -     10.blah::<i32, i32>();
-LL +     10.blah::<i32, >();
+LL +     10.blah::<i32>();
    |
 
 error[E0038]: the trait `bar` cannot be made into an object
diff --git a/tests/ui/transmutability/issue-101739-2.stderr b/tests/ui/transmutability/issue-101739-2.stderr
index 1f640f21ad1..dabb51ee7ae 100644
--- a/tests/ui/transmutability/issue-101739-2.stderr
+++ b/tests/ui/transmutability/issue-101739-2.stderr
@@ -6,10 +6,11 @@ LL |         Dst: BikeshedIntrinsicFrom<
    |
 help: remove the unnecessary generic arguments
    |
+LL -             ASSUME_ALIGNMENT,
 LL -             ASSUME_LIFETIMES,
 LL -             ASSUME_VALIDITY,
 LL -             ASSUME_VISIBILITY,
-LL +             ,
+LL +             ASSUME_ALIGNMENT,
    |
 
 error: aborting due to 1 previous error
diff --git a/tests/ui/typeck/typeck_type_placeholder_lifetime_1.stderr b/tests/ui/typeck/typeck_type_placeholder_lifetime_1.stderr
index 83679f4b1f6..116dd186645 100644
--- a/tests/ui/typeck/typeck_type_placeholder_lifetime_1.stderr
+++ b/tests/ui/typeck/typeck_type_placeholder_lifetime_1.stderr
@@ -12,7 +12,7 @@ LL | struct Foo<'a, T:'a> {
 help: remove the unnecessary generic argument
    |
 LL -     let c: Foo<_, _> = Foo { r: &5 };
-LL +     let c: Foo<_, > = Foo { r: &5 };
+LL +     let c: Foo<_> = Foo { r: &5 };
    |
 
 error: aborting due to 1 previous error
diff --git a/tests/ui/typeck/typeck_type_placeholder_lifetime_2.stderr b/tests/ui/typeck/typeck_type_placeholder_lifetime_2.stderr
index 8d519600edc..d2734f4acc8 100644
--- a/tests/ui/typeck/typeck_type_placeholder_lifetime_2.stderr
+++ b/tests/ui/typeck/typeck_type_placeholder_lifetime_2.stderr
@@ -12,7 +12,7 @@ LL | struct Foo<'a, T:'a> {
 help: remove the unnecessary generic argument
    |
 LL -     let c: Foo<_, usize> = Foo { r: &5 };
-LL +     let c: Foo<_, > = Foo { r: &5 };
+LL +     let c: Foo<_> = Foo { r: &5 };
    |
 
 error: aborting due to 1 previous error