about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorMara Bos <m-ou.se@m-ou.se>2020-11-16 17:26:35 +0100
committerGitHub <noreply@github.com>2020-11-16 17:26:35 +0100
commit835faa532f485883a3da86c14cfe4abdbaa3ce71 (patch)
treed4c8fb5acfc1ec114198b61597753ec3ea2fb7f8 /src/test
parentbac213bee4b709843094a6868f4db98056407ed2 (diff)
parent69b43c209c2808f3b6fe0eef857dc7585503666d (diff)
Rollup merge of #79032 - lcnr:arg-count, r=varkor
improve type const mismatch errors

Doesn't completely remove `check_generic_arg_count` as that would have required some more complex changes but
instead checks type and const params in only one step. Also moved the help added by `@JulianKnodt` in #75611 to `generic_arg_mismatch_err`.

r? `@varkor` cc `@petrochenkov`
Diffstat (limited to 'src/test')
-rw-r--r--src/test/ui/const-generics/const-param-shadowing.rs9
-rw-r--r--src/test/ui/const-generics/const-param-shadowing.stderr14
-rw-r--r--src/test/ui/const-generics/invalid-constant-in-args.rs3
-rw-r--r--src/test/ui/const-generics/invalid-constant-in-args.stderr2
-rw-r--r--src/test/ui/const-generics/invalid-enum.rs12
-rw-r--r--src/test/ui/const-generics/invalid-enum.stderr64
-rw-r--r--src/test/ui/const-generics/issues/issue-62878.full.stderr16
-rw-r--r--src/test/ui/const-generics/issues/issue-62878.rs3
-rw-r--r--src/test/ui/const-generics/issues/issue-76595.rs2
-rw-r--r--src/test/ui/const-generics/issues/issue-76595.stderr4
-rw-r--r--src/test/ui/const-generics/min_const_generics/const-expression-suggest-missing-braces.rs3
-rw-r--r--src/test/ui/const-generics/min_const_generics/const-expression-suggest-missing-braces.stderr36
-rw-r--r--src/test/ui/const-generics/min_const_generics/macro-fail.rs12
-rw-r--r--src/test/ui/const-generics/min_const_generics/macro-fail.stderr56
-rw-r--r--src/test/ui/generics/generic-impl-more-params-with-defaults.stderr4
-rw-r--r--src/test/ui/generics/generic-type-more-params-with-defaults.stderr4
-rw-r--r--src/test/ui/parser/issue-14303-fncall.stderr2
-rw-r--r--src/test/ui/parser/issue-14303-path.stderr2
-rw-r--r--src/test/ui/privacy/privacy-ns1.rs4
-rw-r--r--src/test/ui/privacy/privacy-ns1.stderr16
-rw-r--r--src/test/ui/privacy/privacy-ns2.rs6
-rw-r--r--src/test/ui/privacy/privacy-ns2.stderr42
-rw-r--r--src/test/ui/suggestions/suggest-move-types.stderr4
-rw-r--r--src/test/ui/traits/trait-object-vs-lifetime.stderr2
24 files changed, 123 insertions, 199 deletions
diff --git a/src/test/ui/const-generics/const-param-shadowing.rs b/src/test/ui/const-generics/const-param-shadowing.rs
new file mode 100644
index 00000000000..8440e47968e
--- /dev/null
+++ b/src/test/ui/const-generics/const-param-shadowing.rs
@@ -0,0 +1,9 @@
+#![feature(min_const_generics)]
+
+type N = u32;
+struct Foo<const M: usize>;
+fn test<const N: usize>() -> Foo<N> { //~ ERROR type provided when
+    Foo
+}
+
+fn main() {}
diff --git a/src/test/ui/const-generics/const-param-shadowing.stderr b/src/test/ui/const-generics/const-param-shadowing.stderr
new file mode 100644
index 00000000000..df170278026
--- /dev/null
+++ b/src/test/ui/const-generics/const-param-shadowing.stderr
@@ -0,0 +1,14 @@
+error[E0747]: type provided when a constant was expected
+  --> $DIR/const-param-shadowing.rs:5:34
+   |
+LL | fn test<const N: usize>() -> Foo<N> {
+   |                                  ^
+   |
+help: if this generic argument was intended as a const parameter, try surrounding it with braces:
+   |
+LL | fn test<const N: usize>() -> Foo<{ N }> {
+   |                                  ^   ^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0747`.
diff --git a/src/test/ui/const-generics/invalid-constant-in-args.rs b/src/test/ui/const-generics/invalid-constant-in-args.rs
index 40df237ee72..38ad510e5d7 100644
--- a/src/test/ui/const-generics/invalid-constant-in-args.rs
+++ b/src/test/ui/const-generics/invalid-constant-in-args.rs
@@ -1,3 +1,4 @@
 fn main() {
-    let _: Vec<&str, "a"> = Vec::new(); //~ ERROR wrong number of const arguments
+    let _: Vec<&str, "a"> = Vec::new();
+    //~^ ERROR wrong number of generic arguments
 }
diff --git a/src/test/ui/const-generics/invalid-constant-in-args.stderr b/src/test/ui/const-generics/invalid-constant-in-args.stderr
index b9f874ff18b..5111815e002 100644
--- a/src/test/ui/const-generics/invalid-constant-in-args.stderr
+++ b/src/test/ui/const-generics/invalid-constant-in-args.stderr
@@ -1,4 +1,4 @@
-error[E0107]: wrong number of const arguments: expected 0, found 1
+error[E0107]: wrong number of generic arguments: expected 1, found 2
   --> $DIR/invalid-constant-in-args.rs:2:22
    |
 LL |     let _: Vec<&str, "a"> = Vec::new();
diff --git a/src/test/ui/const-generics/invalid-enum.rs b/src/test/ui/const-generics/invalid-enum.rs
index ceb188a0d3d..4ca10ed8b71 100644
--- a/src/test/ui/const-generics/invalid-enum.rs
+++ b/src/test/ui/const-generics/invalid-enum.rs
@@ -20,20 +20,16 @@ impl<const CF: CompileFlag, T> Example<CF, T> {
 pub fn main() {
   test_1::<CompileFlag::A>();
   //~^ ERROR: expected type, found variant
-  //~| ERROR: wrong number of const arguments
-  //~| ERROR: wrong number of type arguments
+  //~| ERROR: type provided when a constant was expected
 
   test_2::<_, CompileFlag::A>(0);
   //~^ ERROR: expected type, found variant
-  //~| ERROR: wrong number of const arguments
-  //~| ERROR: wrong number of type arguments
+  //~| ERROR: type provided when a constant was expected
 
   let _: Example<CompileFlag::A, _> = Example { x: 0 };
   //~^ ERROR: expected type, found variant
-  //~| ERROR: wrong number of const arguments
-  //~| ERROR: wrong number of type arguments
+  //~| ERROR: type provided when a constant was expected
 
   let _: Example<Example::ASSOC_FLAG, _> = Example { x: 0 };
-  //~^ ERROR: wrong number of const arguments
-  //~| ERROR: wrong number of type arguments
+  //~^ ERROR: type provided when a constant was expected
 }
diff --git a/src/test/ui/const-generics/invalid-enum.stderr b/src/test/ui/const-generics/invalid-enum.stderr
index 965abbc9cb7..7822fc072e3 100644
--- a/src/test/ui/const-generics/invalid-enum.stderr
+++ b/src/test/ui/const-generics/invalid-enum.stderr
@@ -8,7 +8,7 @@ LL |   test_1::<CompileFlag::A>();
    |            help: try using the variant's enum: `CompileFlag`
 
 error[E0573]: expected type, found variant `CompileFlag::A`
-  --> $DIR/invalid-enum.rs:26:15
+  --> $DIR/invalid-enum.rs:25:15
    |
 LL |   test_2::<_, CompileFlag::A>(0);
    |               ^^^^^^^^^^^^^^
@@ -17,7 +17,7 @@ LL |   test_2::<_, CompileFlag::A>(0);
    |               help: try using the variant's enum: `CompileFlag`
 
 error[E0573]: expected type, found variant `CompileFlag::A`
-  --> $DIR/invalid-enum.rs:31:18
+  --> $DIR/invalid-enum.rs:29:18
    |
 LL |   let _: Example<CompileFlag::A, _> = Example { x: 0 };
    |                  ^^^^^^^^^^^^^^
@@ -25,75 +25,51 @@ LL |   let _: Example<CompileFlag::A, _> = Example { x: 0 };
    |                  not a type
    |                  help: try using the variant's enum: `CompileFlag`
 
-error[E0107]: wrong number of const arguments: expected 1, found 0
-  --> $DIR/invalid-enum.rs:31:10
+error[E0747]: type provided when a constant was expected
+  --> $DIR/invalid-enum.rs:29:18
    |
 LL |   let _: Example<CompileFlag::A, _> = Example { x: 0 };
-   |          ^^^^^^^^^^^^^^^^^^^^^^^^^^ expected 1 const argument
-
-error[E0107]: wrong number of type arguments: expected at most 1, found 2
-  --> $DIR/invalid-enum.rs:31:10
-   |
-LL |   let _: Example<CompileFlag::A, _> = Example { x: 0 };
-   |          ^^^^^^^^^^^^^^^^^^^^^^^^^^ expected at most 1 type argument
+   |                  ^^^^^^^^^^^^^^
    |
-help: If this generic argument was intended as a const parameter, try surrounding it with braces:
+help: if this generic argument was intended as a const parameter, try surrounding it with braces:
    |
 LL |   let _: Example<{ CompileFlag::A }, _> = Example { x: 0 };
    |                  ^                ^
 
-error[E0107]: wrong number of const arguments: expected 1, found 0
-  --> $DIR/invalid-enum.rs:36:10
+error[E0747]: type provided when a constant was expected
+  --> $DIR/invalid-enum.rs:33:18
    |
 LL |   let _: Example<Example::ASSOC_FLAG, _> = Example { x: 0 };
-   |          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected 1 const argument
-
-error[E0107]: wrong number of type arguments: expected at most 1, found 2
-  --> $DIR/invalid-enum.rs:36:10
-   |
-LL |   let _: Example<Example::ASSOC_FLAG, _> = Example { x: 0 };
-   |          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected at most 1 type argument
+   |                  ^^^^^^^^^^^^^^^^^^^
    |
-help: If this generic argument was intended as a const parameter, try surrounding it with braces:
+help: if this generic argument was intended as a const parameter, try surrounding it with braces:
    |
 LL |   let _: Example<{ Example::ASSOC_FLAG }, _> = Example { x: 0 };
    |                  ^                     ^
 
-error[E0107]: wrong number of const arguments: expected 1, found 0
-  --> $DIR/invalid-enum.rs:21:3
-   |
-LL |   test_1::<CompileFlag::A>();
-   |   ^^^^^^^^^^^^^^^^^^^^^^^^ expected 1 const argument
-
-error[E0107]: wrong number of type arguments: expected 0, found 1
+error[E0747]: type provided when a constant was expected
   --> $DIR/invalid-enum.rs:21:12
    |
 LL |   test_1::<CompileFlag::A>();
-   |            ^^^^^^^^^^^^^^ unexpected type argument
+   |            ^^^^^^^^^^^^^^
    |
-help: If this generic argument was intended as a const parameter, try surrounding it with braces:
+help: if this generic argument was intended as a const parameter, try surrounding it with braces:
    |
 LL |   test_1::<{ CompileFlag::A }>();
    |            ^                ^
 
-error[E0107]: wrong number of const arguments: expected 1, found 0
-  --> $DIR/invalid-enum.rs:26:3
+error[E0747]: type provided when a constant was expected
+  --> $DIR/invalid-enum.rs:25:15
    |
 LL |   test_2::<_, CompileFlag::A>(0);
-   |   ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected 1 const argument
-
-error[E0107]: wrong number of type arguments: expected 1, found 2
-  --> $DIR/invalid-enum.rs:26:15
-   |
-LL |   test_2::<_, CompileFlag::A>(0);
-   |               ^^^^^^^^^^^^^^ unexpected type argument
+   |               ^^^^^^^^^^^^^^
    |
-help: If this generic argument was intended as a const parameter, try surrounding it with braces:
+help: if this generic argument was intended as a const parameter, try surrounding it with braces:
    |
 LL |   test_2::<_, { CompileFlag::A }>(0);
    |               ^                ^
 
-error: aborting due to 11 previous errors
+error: aborting due to 7 previous errors
 
-Some errors have detailed explanations: E0107, E0573.
-For more information about an error, try `rustc --explain E0107`.
+Some errors have detailed explanations: E0573, E0747.
+For more information about an error, try `rustc --explain E0573`.
diff --git a/src/test/ui/const-generics/issues/issue-62878.full.stderr b/src/test/ui/const-generics/issues/issue-62878.full.stderr
index c8b9db89410..fc70be40497 100644
--- a/src/test/ui/const-generics/issues/issue-62878.full.stderr
+++ b/src/test/ui/const-generics/issues/issue-62878.full.stderr
@@ -4,17 +4,11 @@ error[E0770]: the type of const parameters must not depend on other generic para
 LL | fn foo<const N: usize, const A: [u8; N]>() {}
    |                                      ^ the type must not depend on the parameter `N`
 
-error[E0107]: wrong number of const arguments: expected 2, found 1
-  --> $DIR/issue-62878.rs:11:5
-   |
-LL |     foo::<_, {[1]}>();
-   |     ^^^^^^^^^^^^^^^ expected 2 const arguments
-
-error[E0107]: wrong number of type arguments: expected 0, found 1
+error[E0747]: type provided when a constant was expected
   --> $DIR/issue-62878.rs:11:11
    |
 LL |     foo::<_, {[1]}>();
-   |           ^ unexpected type argument
+   |           ^
 
 error[E0308]: mismatched types
   --> $DIR/issue-62878.rs:11:15
@@ -22,7 +16,7 @@ error[E0308]: mismatched types
 LL |     foo::<_, {[1]}>();
    |               ^^^ expected `usize`, found array `[{integer}; 1]`
 
-error: aborting due to 4 previous errors
+error: aborting due to 3 previous errors
 
-Some errors have detailed explanations: E0107, E0308, E0770.
-For more information about an error, try `rustc --explain E0107`.
+Some errors have detailed explanations: E0308, E0747, E0770.
+For more information about an error, try `rustc --explain E0308`.
diff --git a/src/test/ui/const-generics/issues/issue-62878.rs b/src/test/ui/const-generics/issues/issue-62878.rs
index 0487dda2fe8..c087711e5f9 100644
--- a/src/test/ui/const-generics/issues/issue-62878.rs
+++ b/src/test/ui/const-generics/issues/issue-62878.rs
@@ -9,7 +9,6 @@ fn foo<const N: usize, const A: [u8; N]>() {}
 
 fn main() {
     foo::<_, {[1]}>();
-    //[full]~^ ERROR wrong number of const arguments
-    //[full]~| ERROR wrong number of type arguments
+    //[full]~^ ERROR type provided when a constant was expected
     //[full]~| ERROR mismatched types
 }
diff --git a/src/test/ui/const-generics/issues/issue-76595.rs b/src/test/ui/const-generics/issues/issue-76595.rs
index 9fdbbff66e9..04c01901517 100644
--- a/src/test/ui/const-generics/issues/issue-76595.rs
+++ b/src/test/ui/const-generics/issues/issue-76595.rs
@@ -13,5 +13,5 @@ fn test<T, const P: usize>() where Bool<{core::mem::size_of::<T>() > 4}>: True {
 
 fn main() {
     test::<2>();
-    //~^ ERROR wrong number of type
+    //~^ ERROR wrong number of generic arguments
 }
diff --git a/src/test/ui/const-generics/issues/issue-76595.stderr b/src/test/ui/const-generics/issues/issue-76595.stderr
index f258d297718..1e37f9dcb19 100644
--- a/src/test/ui/const-generics/issues/issue-76595.stderr
+++ b/src/test/ui/const-generics/issues/issue-76595.stderr
@@ -1,8 +1,8 @@
-error[E0107]: wrong number of type arguments: expected 1, found 0
+error[E0107]: wrong number of generic arguments: expected 2, found 1
   --> $DIR/issue-76595.rs:15:5
    |
 LL |     test::<2>();
-   |     ^^^^^^^^^ expected 1 type argument
+   |     ^^^^^^^^^ expected 2 generic arguments
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/const-generics/min_const_generics/const-expression-suggest-missing-braces.rs b/src/test/ui/const-generics/min_const_generics/const-expression-suggest-missing-braces.rs
index aea3def5aeb..b96d5c561ff 100644
--- a/src/test/ui/const-generics/min_const_generics/const-expression-suggest-missing-braces.rs
+++ b/src/test/ui/const-generics/min_const_generics/const-expression-suggest-missing-braces.rs
@@ -13,8 +13,7 @@ fn b() {
     foo::<BAR + BAR>();
     //~^ ERROR expected trait, found constant `BAR`
     //~| ERROR expected trait, found constant `BAR`
-    //~| ERROR wrong number of const arguments: expected 1, found 0
-    //~| ERROR wrong number of type arguments: expected 0, found 1
+    //~| ERROR type provided when a constant was expected
     //~| WARN trait objects without an explicit `dyn` are deprecated
 }
 fn c() {
diff --git a/src/test/ui/const-generics/min_const_generics/const-expression-suggest-missing-braces.stderr b/src/test/ui/const-generics/min_const_generics/const-expression-suggest-missing-braces.stderr
index 47e9dc034ef..6adcf6a3e36 100644
--- a/src/test/ui/const-generics/min_const_generics/const-expression-suggest-missing-braces.stderr
+++ b/src/test/ui/const-generics/min_const_generics/const-expression-suggest-missing-braces.stderr
@@ -10,7 +10,7 @@ LL |     foo::<{ BAR + 3 }>();
    |           ^         ^
 
 error: expressions must be enclosed in braces to be used as const generic arguments
-  --> $DIR/const-expression-suggest-missing-braces.rs:21:11
+  --> $DIR/const-expression-suggest-missing-braces.rs:20:11
    |
 LL |     foo::<3 + 3>();
    |           ^^^^^
@@ -21,7 +21,7 @@ LL |     foo::<{ 3 + 3 }>();
    |           ^       ^
 
 error: expected one of `,` or `>`, found `-`
-  --> $DIR/const-expression-suggest-missing-braces.rs:24:15
+  --> $DIR/const-expression-suggest-missing-braces.rs:23:15
    |
 LL |     foo::<BAR - 3>();
    |               ^ expected one of `,` or `>`
@@ -32,7 +32,7 @@ LL |     foo::<{ BAR - 3 }>();
    |           ^         ^
 
 error: expected one of `,` or `>`, found `-`
-  --> $DIR/const-expression-suggest-missing-braces.rs:27:15
+  --> $DIR/const-expression-suggest-missing-braces.rs:26:15
    |
 LL |     foo::<BAR - BAR>();
    |               ^ expected one of `,` or `>`
@@ -43,7 +43,7 @@ LL |     foo::<{ BAR - BAR }>();
    |           ^           ^
 
 error: expressions must be enclosed in braces to be used as const generic arguments
-  --> $DIR/const-expression-suggest-missing-braces.rs:30:11
+  --> $DIR/const-expression-suggest-missing-braces.rs:29:11
    |
 LL |     foo::<100 - BAR>();
    |           ^^^^^^^^^
@@ -54,7 +54,7 @@ LL |     foo::<{ 100 - BAR }>();
    |           ^           ^
 
 error: expected one of `,` or `>`, found `(`
-  --> $DIR/const-expression-suggest-missing-braces.rs:33:19
+  --> $DIR/const-expression-suggest-missing-braces.rs:32:19
    |
 LL |     foo::<bar<i32>()>();
    |                   ^ expected one of `,` or `>`
@@ -65,7 +65,7 @@ LL |     foo::<{ bar<i32>() }>();
    |           ^            ^
 
 error: expected one of `,` or `>`, found `(`
-  --> $DIR/const-expression-suggest-missing-braces.rs:36:21
+  --> $DIR/const-expression-suggest-missing-braces.rs:35:21
    |
 LL |     foo::<bar::<i32>()>();
    |                     ^ expected one of `,` or `>`
@@ -76,7 +76,7 @@ LL |     foo::<{ bar::<i32>() }>();
    |           ^              ^
 
 error: expected one of `,` or `>`, found `(`
-  --> $DIR/const-expression-suggest-missing-braces.rs:39:21
+  --> $DIR/const-expression-suggest-missing-braces.rs:38:21
    |
 LL |     foo::<bar::<i32>() + BAR>();
    |                     ^ expected one of `,` or `>`
@@ -87,7 +87,7 @@ LL |     foo::<{ bar::<i32>() + BAR }>();
    |           ^                    ^
 
 error: expected one of `,` or `>`, found `(`
-  --> $DIR/const-expression-suggest-missing-braces.rs:42:21
+  --> $DIR/const-expression-suggest-missing-braces.rs:41:21
    |
 LL |     foo::<bar::<i32>() - BAR>();
    |                     ^ expected one of `,` or `>`
@@ -98,7 +98,7 @@ LL |     foo::<{ bar::<i32>() - BAR }>();
    |           ^                    ^
 
 error: expected one of `,` or `>`, found `-`
-  --> $DIR/const-expression-suggest-missing-braces.rs:45:15
+  --> $DIR/const-expression-suggest-missing-braces.rs:44:15
    |
 LL |     foo::<BAR - bar::<i32>()>();
    |               ^ expected one of `,` or `>`
@@ -109,7 +109,7 @@ LL |     foo::<{ BAR - bar::<i32>() }>();
    |           ^                    ^
 
 error: expected one of `,` or `>`, found `-`
-  --> $DIR/const-expression-suggest-missing-braces.rs:48:15
+  --> $DIR/const-expression-suggest-missing-braces.rs:47:15
    |
 LL |     foo::<BAR - bar::<i32>()>();
    |               ^ expected one of `,` or `>`
@@ -139,19 +139,13 @@ LL |     foo::<BAR + BAR>();
    |
    = note: `#[warn(bare_trait_objects)]` on by default
 
-error[E0107]: wrong number of const arguments: expected 1, found 0
-  --> $DIR/const-expression-suggest-missing-braces.rs:13:5
-   |
-LL |     foo::<BAR + BAR>();
-   |     ^^^^^^^^^^^^^^^^ expected 1 const argument
-
-error[E0107]: wrong number of type arguments: expected 0, found 1
+error[E0747]: type provided when a constant was expected
   --> $DIR/const-expression-suggest-missing-braces.rs:13:11
    |
 LL |     foo::<BAR + BAR>();
-   |           ^^^^^^^^^ unexpected type argument
+   |           ^^^^^^^^^
 
-error: aborting due to 15 previous errors; 1 warning emitted
+error: aborting due to 14 previous errors; 1 warning emitted
 
-Some errors have detailed explanations: E0107, E0404.
-For more information about an error, try `rustc --explain E0107`.
+Some errors have detailed explanations: E0404, E0747.
+For more information about an error, try `rustc --explain E0404`.
diff --git a/src/test/ui/const-generics/min_const_generics/macro-fail.rs b/src/test/ui/const-generics/min_const_generics/macro-fail.rs
index 7f16f2f33de..1bd0c46f55e 100644
--- a/src/test/ui/const-generics/min_const_generics/macro-fail.rs
+++ b/src/test/ui/const-generics/min_const_generics/macro-fail.rs
@@ -14,11 +14,9 @@ trait Marker<const N: usize> {}
 impl<const N: usize> Marker<N> for Example<N> {}
 
 fn make_marker() -> impl Marker<gimme_a_const!(marker)> {
-  //~^ ERROR wrong number of const
-  //~| ERROR wrong number of type
+  //~^ ERROR: type provided when a constant was expected
   Example::<gimme_a_const!(marker)>
-  //~^ ERROR wrong number of const
-  //~| ERROR wrong number of type
+  //~^ ERROR: type provided when a constant was expected
 }
 
 fn from_marker(_: impl Marker<{
@@ -38,11 +36,9 @@ fn main() {
   }>;
 
   let _fail = Example::<external_macro!()>;
-  //~^ ERROR wrong number of const
-  //~| ERROR wrong number of type
+  //~^ ERROR: type provided when a constant was expected
 
   let _fail = Example::<gimme_a_const!()>;
-  //~^ ERROR wrong number of const
-  //~| ERROR wrong number of type
+  //~^ ERROR: type provided when a constant was expected
   //~| ERROR unexpected end of macro invocation
 }
diff --git a/src/test/ui/const-generics/min_const_generics/macro-fail.stderr b/src/test/ui/const-generics/min_const_generics/macro-fail.stderr
index fe7a4a5c382..a5dedf6fe20 100644
--- a/src/test/ui/const-generics/min_const_generics/macro-fail.stderr
+++ b/src/test/ui/const-generics/min_const_generics/macro-fail.stderr
@@ -1,5 +1,5 @@
 error: expected type, found `{`
-  --> $DIR/macro-fail.rs:33:27
+  --> $DIR/macro-fail.rs:31:27
    |
 LL | fn make_marker() -> impl Marker<gimme_a_const!(marker)> {
    |                                 ----------------------
@@ -13,7 +13,7 @@ LL |       ($rusty: ident) => {{ let $rusty = 3; *&$rusty }}
    = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: expected type, found `{`
-  --> $DIR/macro-fail.rs:33:27
+  --> $DIR/macro-fail.rs:31:27
    |
 LL |   Example::<gimme_a_const!(marker)>
    |             ----------------------
@@ -46,7 +46,7 @@ LL |     let _fail = Example::<external_macro!()>;
    = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: unexpected end of macro invocation
-  --> $DIR/macro-fail.rs:44:25
+  --> $DIR/macro-fail.rs:41:25
    |
 LL |     macro_rules! gimme_a_const {
    |     -------------------------- when calling this macro
@@ -54,54 +54,30 @@ LL |     macro_rules! gimme_a_const {
 LL |   let _fail = Example::<gimme_a_const!()>;
    |                         ^^^^^^^^^^^^^^^^ missing tokens in macro arguments
 
-error[E0107]: wrong number of const arguments: expected 1, found 0
-  --> $DIR/macro-fail.rs:16:26
-   |
-LL | fn make_marker() -> impl Marker<gimme_a_const!(marker)> {
-   |                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected 1 const argument
-
-error[E0107]: wrong number of type arguments: expected 0, found 1
+error[E0747]: type provided when a constant was expected
   --> $DIR/macro-fail.rs:16:33
    |
 LL | fn make_marker() -> impl Marker<gimme_a_const!(marker)> {
-   |                                 ^^^^^^^^^^^^^^^^^^^^^^ unexpected type argument
-
-error[E0107]: wrong number of const arguments: expected 1, found 0
-  --> $DIR/macro-fail.rs:19:3
-   |
-LL |   Example::<gimme_a_const!(marker)>
-   |   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected 1 const argument
+   |                                 ^^^^^^^^^^^^^^^^^^^^^^
 
-error[E0107]: wrong number of type arguments: expected 0, found 1
-  --> $DIR/macro-fail.rs:19:13
+error[E0747]: type provided when a constant was expected
+  --> $DIR/macro-fail.rs:18:13
    |
 LL |   Example::<gimme_a_const!(marker)>
-   |             ^^^^^^^^^^^^^^^^^^^^^^ unexpected type argument
+   |             ^^^^^^^^^^^^^^^^^^^^^^
 
-error[E0107]: wrong number of const arguments: expected 1, found 0
-  --> $DIR/macro-fail.rs:40:15
+error[E0747]: type provided when a constant was expected
+  --> $DIR/macro-fail.rs:38:25
    |
 LL |   let _fail = Example::<external_macro!()>;
-   |               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected 1 const argument
-
-error[E0107]: wrong number of type arguments: expected 0, found 1
-  --> $DIR/macro-fail.rs:40:25
-   |
-LL |   let _fail = Example::<external_macro!()>;
-   |                         ^^^^^^^^^^^^^^^^^ unexpected type argument
-
-error[E0107]: wrong number of const arguments: expected 1, found 0
-  --> $DIR/macro-fail.rs:44:15
-   |
-LL |   let _fail = Example::<gimme_a_const!()>;
-   |               ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected 1 const argument
+   |                         ^^^^^^^^^^^^^^^^^
 
-error[E0107]: wrong number of type arguments: expected 0, found 1
-  --> $DIR/macro-fail.rs:44:25
+error[E0747]: type provided when a constant was expected
+  --> $DIR/macro-fail.rs:41:25
    |
 LL |   let _fail = Example::<gimme_a_const!()>;
-   |                         ^^^^^^^^^^^^^^^^ unexpected type argument
+   |                         ^^^^^^^^^^^^^^^^
 
-error: aborting due to 12 previous errors
+error: aborting due to 8 previous errors
 
-For more information about this error, try `rustc --explain E0107`.
+For more information about this error, try `rustc --explain E0747`.
diff --git a/src/test/ui/generics/generic-impl-more-params-with-defaults.stderr b/src/test/ui/generics/generic-impl-more-params-with-defaults.stderr
index 66950d450a1..380e9209e6c 100644
--- a/src/test/ui/generics/generic-impl-more-params-with-defaults.stderr
+++ b/src/test/ui/generics/generic-impl-more-params-with-defaults.stderr
@@ -1,8 +1,8 @@
 error[E0107]: wrong number of type arguments: expected at most 2, found 3
-  --> $DIR/generic-impl-more-params-with-defaults.rs:13:5
+  --> $DIR/generic-impl-more-params-with-defaults.rs:13:24
    |
 LL |     Vec::<isize, Heap, bool>::new();
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected at most 2 type arguments
+   |                        ^^^^ unexpected type argument
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/generics/generic-type-more-params-with-defaults.stderr b/src/test/ui/generics/generic-type-more-params-with-defaults.stderr
index 5031930b1bb..cc296b5105a 100644
--- a/src/test/ui/generics/generic-type-more-params-with-defaults.stderr
+++ b/src/test/ui/generics/generic-type-more-params-with-defaults.stderr
@@ -1,8 +1,8 @@
 error[E0107]: wrong number of type arguments: expected at most 2, found 3
-  --> $DIR/generic-type-more-params-with-defaults.rs:9:12
+  --> $DIR/generic-type-more-params-with-defaults.rs:9:29
    |
 LL |     let _: Vec<isize, Heap, bool>;
-   |            ^^^^^^^^^^^^^^^^^^^^^^ expected at most 2 type arguments
+   |                             ^^^^ unexpected type argument
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/parser/issue-14303-fncall.stderr b/src/test/ui/parser/issue-14303-fncall.stderr
index 10954223713..cdda0d001c7 100644
--- a/src/test/ui/parser/issue-14303-fncall.stderr
+++ b/src/test/ui/parser/issue-14303-fncall.stderr
@@ -3,8 +3,6 @@ error[E0747]: type provided when a lifetime was expected
    |
 LL |         .collect::<Vec<S<_, 'a>>>();
    |                          ^
-   |
-   = note: lifetime arguments must be provided before type arguments
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/parser/issue-14303-path.stderr b/src/test/ui/parser/issue-14303-path.stderr
index c1ad2332b5b..841e63ecbe9 100644
--- a/src/test/ui/parser/issue-14303-path.stderr
+++ b/src/test/ui/parser/issue-14303-path.stderr
@@ -3,8 +3,6 @@ error[E0747]: type provided when a lifetime was expected
    |
 LL | fn bar<'a, 'b, 'c, T>(x: foo::X<'a, T, 'b, 'c>) {}
    |                                     ^
-   |
-   = note: lifetime arguments must be provided before type arguments
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/privacy/privacy-ns1.rs b/src/test/ui/privacy/privacy-ns1.rs
index c7084bfd980..1af5b857e9d 100644
--- a/src/test/ui/privacy/privacy-ns1.rs
+++ b/src/test/ui/privacy/privacy-ns1.rs
@@ -32,8 +32,8 @@ pub mod foo2 {
 fn test_glob2() {
     use foo2::*;
 
-    let _x: Box<Bar>;  //~ ERROR wrong number of const arguments: expected 0, found 1
-    //~^ ERROR wrong number of type arguments: expected at least 1, found 0
+    let _x: Box<Bar>;
+    //~^ ERROR constant provided when a type was expected
 }
 
 // neither public
diff --git a/src/test/ui/privacy/privacy-ns1.stderr b/src/test/ui/privacy/privacy-ns1.stderr
index ccbb5d5c90f..714f28941f1 100644
--- a/src/test/ui/privacy/privacy-ns1.stderr
+++ b/src/test/ui/privacy/privacy-ns1.stderr
@@ -52,19 +52,13 @@ help: consider importing this trait
 LL | use foo1::Bar;
    |
 
-error[E0107]: wrong number of const arguments: expected 0, found 1
+error[E0747]: constant provided when a type was expected
   --> $DIR/privacy-ns1.rs:35:17
    |
 LL |     let _x: Box<Bar>;
-   |                 ^^^ unexpected const argument
-
-error[E0107]: wrong number of type arguments: expected at least 1, found 0
-  --> $DIR/privacy-ns1.rs:35:13
-   |
-LL |     let _x: Box<Bar>;
-   |             ^^^^^^^^ expected at least 1 type argument
+   |                 ^^^
 
-error: aborting due to 5 previous errors
+error: aborting due to 4 previous errors
 
-Some errors have detailed explanations: E0107, E0412, E0423, E0425.
-For more information about an error, try `rustc --explain E0107`.
+Some errors have detailed explanations: E0412, E0423, E0425, E0747.
+For more information about an error, try `rustc --explain E0412`.
diff --git a/src/test/ui/privacy/privacy-ns2.rs b/src/test/ui/privacy/privacy-ns2.rs
index b770c8f8f86..47035ef3af5 100644
--- a/src/test/ui/privacy/privacy-ns2.rs
+++ b/src/test/ui/privacy/privacy-ns2.rs
@@ -38,16 +38,14 @@ pub mod foo2 {
 fn test_single2() {
     use foo2::Bar;
 
-    let _x : Box<Bar>; //~ ERROR wrong number of const arguments: expected 0, found 1
-    //~^ ERROR wrong number of type arguments: expected at least 1, found 0
+    let _x : Box<Bar>; //~ ERROR constant provided when a type was expected
     let _x : Bar(); //~ ERROR expected type, found function `Bar`
 }
 
 fn test_list2() {
     use foo2::{Bar,Baz};
 
-    let _x: Box<Bar>; //~ ERROR wrong number of const arguments: expected 0, found 1
-    //~^ ERROR wrong number of type arguments: expected at least 1, found 0
+    let _x: Box<Bar>; //~ ERROR constant provided when a type was expected
 }
 
 // neither public
diff --git a/src/test/ui/privacy/privacy-ns2.stderr b/src/test/ui/privacy/privacy-ns2.stderr
index dbb269c0ba6..c7ad8ec5036 100644
--- a/src/test/ui/privacy/privacy-ns2.stderr
+++ b/src/test/ui/privacy/privacy-ns2.stderr
@@ -28,7 +28,7 @@ LL | use foo2::Bar;
    |
 
 error[E0573]: expected type, found function `Bar`
-  --> $DIR/privacy-ns2.rs:43:14
+  --> $DIR/privacy-ns2.rs:42:14
    |
 LL |     let _x : Bar();
    |              ^^^^^ not a type
@@ -43,66 +43,54 @@ LL | use foo1::Bar;
    |
 
 error[E0603]: trait `Bar` is private
-  --> $DIR/privacy-ns2.rs:63:15
+  --> $DIR/privacy-ns2.rs:61:15
    |
 LL |     use foo3::Bar;
    |               ^^^ private trait
    |
 note: the trait `Bar` is defined here
-  --> $DIR/privacy-ns2.rs:55:5
+  --> $DIR/privacy-ns2.rs:53:5
    |
 LL |     trait Bar {
    |     ^^^^^^^^^
 
 error[E0603]: trait `Bar` is private
-  --> $DIR/privacy-ns2.rs:67:15
+  --> $DIR/privacy-ns2.rs:65:15
    |
 LL |     use foo3::Bar;
    |               ^^^ private trait
    |
 note: the trait `Bar` is defined here
-  --> $DIR/privacy-ns2.rs:55:5
+  --> $DIR/privacy-ns2.rs:53:5
    |
 LL |     trait Bar {
    |     ^^^^^^^^^
 
 error[E0603]: trait `Bar` is private
-  --> $DIR/privacy-ns2.rs:74:16
+  --> $DIR/privacy-ns2.rs:72:16
    |
 LL |     use foo3::{Bar,Baz};
    |                ^^^ private trait
    |
 note: the trait `Bar` is defined here
-  --> $DIR/privacy-ns2.rs:55:5
+  --> $DIR/privacy-ns2.rs:53:5
    |
 LL |     trait Bar {
    |     ^^^^^^^^^
 
-error[E0107]: wrong number of const arguments: expected 0, found 1
+error[E0747]: constant provided when a type was expected
   --> $DIR/privacy-ns2.rs:41:18
    |
 LL |     let _x : Box<Bar>;
-   |                  ^^^ unexpected const argument
+   |                  ^^^
 
-error[E0107]: wrong number of type arguments: expected at least 1, found 0
-  --> $DIR/privacy-ns2.rs:41:14
-   |
-LL |     let _x : Box<Bar>;
-   |              ^^^^^^^^ expected at least 1 type argument
-
-error[E0107]: wrong number of const arguments: expected 0, found 1
-  --> $DIR/privacy-ns2.rs:49:17
-   |
-LL |     let _x: Box<Bar>;
-   |                 ^^^ unexpected const argument
-
-error[E0107]: wrong number of type arguments: expected at least 1, found 0
-  --> $DIR/privacy-ns2.rs:49:13
+error[E0747]: constant provided when a type was expected
+  --> $DIR/privacy-ns2.rs:48:17
    |
 LL |     let _x: Box<Bar>;
-   |             ^^^^^^^^ expected at least 1 type argument
+   |                 ^^^
 
-error: aborting due to 10 previous errors
+error: aborting due to 8 previous errors
 
-Some errors have detailed explanations: E0107, E0423, E0573, E0603.
-For more information about an error, try `rustc --explain E0107`.
+Some errors have detailed explanations: E0423, E0573, E0603, E0747.
+For more information about an error, try `rustc --explain E0423`.
diff --git a/src/test/ui/suggestions/suggest-move-types.stderr b/src/test/ui/suggestions/suggest-move-types.stderr
index 3c2226574ee..df064f22f35 100644
--- a/src/test/ui/suggestions/suggest-move-types.stderr
+++ b/src/test/ui/suggestions/suggest-move-types.stderr
@@ -107,16 +107,12 @@ error[E0747]: type provided when a lifetime was expected
    |
 LL | struct Al<'a, T, M: OneWithLifetime<A=(), T, 'a>> {
    |                                           ^
-   |
-   = note: lifetime arguments must be provided before type arguments
 
 error[E0747]: type provided when a lifetime was expected
   --> $DIR/suggest-move-types.rs:48:71
    |
 LL | struct Bl<'a, 'b, 'c, T, U, V, M: ThreeWithLifetime<A=(), B=(), C=(), T, U, V, 'a, 'b, 'c>> {
    |                                                                       ^
-   |
-   = note: lifetime arguments must be provided before type arguments
 
 error[E0747]: lifetime provided when a type was expected
   --> $DIR/suggest-move-types.rs:65:56
diff --git a/src/test/ui/traits/trait-object-vs-lifetime.stderr b/src/test/ui/traits/trait-object-vs-lifetime.stderr
index ff3fc2a197c..8958547e827 100644
--- a/src/test/ui/traits/trait-object-vs-lifetime.stderr
+++ b/src/test/ui/traits/trait-object-vs-lifetime.stderr
@@ -27,8 +27,6 @@ error[E0747]: type provided when a lifetime was expected
    |
 LL |     let _: S<dyn 'static +, 'static>;
    |              ^^^^^^^^^^^^^
-   |
-   = note: lifetime arguments must be provided before type arguments
 
 error: aborting due to 5 previous errors