about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEsteban Küber <esteban@kuber.com.ar>2022-06-01 16:55:30 -0700
committerEsteban Küber <esteban@kuber.com.ar>2022-06-01 17:46:55 -0700
commitad63f907e987673fc99dce3e4d1437720705f5a8 (patch)
treec4311c51cea569aad8bdf4a50403c0dc292f5e92
parent196a30ebff0156240b3297f9859fb57fe725c081 (diff)
downloadrust-ad63f907e987673fc99dce3e4d1437720705f5a8.tar.gz
rust-ad63f907e987673fc99dce3e4d1437720705f5a8.zip
Make output more specific
-rw-r--r--compiler/rustc_typeck/src/astconv/mod.rs47
-rw-r--r--src/test/ui/derives/issue-97343.rs2
-rw-r--r--src/test/ui/derives/issue-97343.stderr7
-rw-r--r--src/test/ui/error-codes/E0109.stderr6
-rw-r--r--src/test/ui/error-codes/E0110.stderr6
-rw-r--r--src/test/ui/issues/issue-22706.rs2
-rw-r--r--src/test/ui/issues/issue-22706.stderr6
-rw-r--r--src/test/ui/issues/issue-57924.rs2
-rw-r--r--src/test/ui/issues/issue-57924.stderr6
-rw-r--r--src/test/ui/issues/issue-60989.rs4
-rw-r--r--src/test/ui/issues/issue-60989.stderr12
-rw-r--r--src/test/ui/mod-subitem-as-enum-variant.rs2
-rw-r--r--src/test/ui/mod-subitem-as-enum-variant.stderr6
-rw-r--r--src/test/ui/structs/struct-path-associated-type.rs4
-rw-r--r--src/test/ui/structs/struct-path-associated-type.stderr12
-rw-r--r--src/test/ui/structs/struct-path-self.rs6
-rw-r--r--src/test/ui/structs/struct-path-self.stderr18
-rw-r--r--src/test/ui/type-alias-enum-variants/enum-variant-generic-args.rs54
-rw-r--r--src/test/ui/type-alias-enum-variants/enum-variant-generic-args.stderr162
-rw-r--r--src/test/ui/type-alias-enum-variants/no-type-application-on-aliased-enum-variant.rs2
-rw-r--r--src/test/ui/type-alias-enum-variants/no-type-application-on-aliased-enum-variant.stderr6
-rw-r--r--src/test/ui/type/issue-91268.rs2
-rw-r--r--src/test/ui/type/issue-91268.stderr6
-rw-r--r--src/test/ui/typeck/prim-with-args.fixed44
-rw-r--r--src/test/ui/typeck/prim-with-args.rs44
-rw-r--r--src/test/ui/typeck/prim-with-args.stderr132
-rw-r--r--src/test/ui/usize-generic-argument-parent.rs2
-rw-r--r--src/test/ui/usize-generic-argument-parent.stderr6
28 files changed, 391 insertions, 217 deletions
diff --git a/compiler/rustc_typeck/src/astconv/mod.rs b/compiler/rustc_typeck/src/astconv/mod.rs
index 7efec3f51f7..405acfc186c 100644
--- a/compiler/rustc_typeck/src/astconv/mod.rs
+++ b/compiler/rustc_typeck/src/astconv/mod.rs
@@ -2108,6 +2108,46 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
         extend: impl Fn(&mut DiagnosticBuilder<'tcx, ErrorGuaranteed>),
     ) -> bool {
         let args = segments.clone().flat_map(|segment| segment.args().args);
+        let types_and_spans: Vec<_> = segments
+            .clone()
+            .flat_map(|segment| {
+                segment.res.and_then(|res| {
+                    if segment.args().args.is_empty() {
+                        None
+                    } else {
+                        let mut desc = res.descr();
+                        if desc == "unresolved item" {
+                            desc = "this type";
+                        };
+
+                        let name = match res {
+                            Res::PrimTy(ty) => Some(ty.name()),
+                            Res::Def(_, def_id) => self.tcx().opt_item_name(def_id),
+                            _ => None,
+                        };
+                        Some((
+                            match name {
+                                Some(ty) => format!("{desc} `{ty}`"),
+                                None => desc.to_string(),
+                            },
+                            segment.ident.span,
+                        ))
+                    }
+                })
+            })
+            .collect();
+        let this_type = match &types_and_spans[..] {
+            [.., _, (last, _)] => format!(
+                "{} and {last}",
+                types_and_spans[..types_and_spans.len() - 1]
+                    .iter()
+                    .map(|(x, _)| x.as_str())
+                    .intersperse(&", ")
+                    .collect::<String>()
+            ),
+            [(only, _)] => only.to_string(),
+            [] => "this type".to_string(),
+        };
 
         let (lt, ty, ct, inf) =
             args.clone().fold((false, false, false, false), |(lt, ty, ct, inf), arg| match arg {
@@ -2143,7 +2183,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
             let (kind, s) = match types[..] {
                 [.., _, last] => (
                     format!(
-                        "{} and `{last}`",
+                        "{} and {last}",
                         types[..types.len() - 1]
                             .iter()
                             .map(|&x| x)
@@ -2161,9 +2201,12 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
                 self.tcx().sess,
                 span,
                 E0109,
-                "{kind} arguments are not allowed for this type",
+                "{kind} arguments are not allowed on {this_type}",
             );
             err.span_label(last_span, format!("{kind} argument{s} not allowed"));
+            for (_, span) in types_and_spans {
+                err.span_label(span, "not allowed on this");
+            }
             extend(&mut err);
             err.emit();
             emitted = true;
diff --git a/src/test/ui/derives/issue-97343.rs b/src/test/ui/derives/issue-97343.rs
index adec6c7a5c5..6f0e4d55aeb 100644
--- a/src/test/ui/derives/issue-97343.rs
+++ b/src/test/ui/derives/issue-97343.rs
@@ -1,7 +1,7 @@
 use std::fmt::Debug;
 
 #[derive(Debug)]
-pub struct Irrelevant<Irrelevant> { //~ ERROR type arguments are not allowed for this type
+pub struct Irrelevant<Irrelevant> { //~ ERROR type arguments are not allowed on type parameter
     irrelevant: Irrelevant,
 }
 
diff --git a/src/test/ui/derives/issue-97343.stderr b/src/test/ui/derives/issue-97343.stderr
index 4679ef2cc7b..ac797a8f501 100644
--- a/src/test/ui/derives/issue-97343.stderr
+++ b/src/test/ui/derives/issue-97343.stderr
@@ -1,8 +1,11 @@
-error[E0109]: type arguments are not allowed for this type
+error[E0109]: type arguments are not allowed on type parameter `Irrelevant`
   --> $DIR/issue-97343.rs:4:23
    |
 LL | #[derive(Debug)]
-   |          ----- in this derive macro expansion
+   |          -----
+   |          |
+   |          not allowed on this
+   |          in this derive macro expansion
 LL | pub struct Irrelevant<Irrelevant> {
    |                       ^^^^^^^^^^ type argument not allowed
    |
diff --git a/src/test/ui/error-codes/E0109.stderr b/src/test/ui/error-codes/E0109.stderr
index cb12bcd1ba4..e91c74151b3 100644
--- a/src/test/ui/error-codes/E0109.stderr
+++ b/src/test/ui/error-codes/E0109.stderr
@@ -1,8 +1,10 @@
-error[E0109]: type arguments are not allowed for this type
+error[E0109]: type arguments are not allowed on this type
   --> $DIR/E0109.rs:1:14
    |
 LL | type X = u32<i32>;
-   |              ^^^ type argument not allowed
+   |          --- ^^^ type argument not allowed
+   |          |
+   |          not allowed on this
    |
 help: primitive type `u32` doesn't have type parameters
    |
diff --git a/src/test/ui/error-codes/E0110.stderr b/src/test/ui/error-codes/E0110.stderr
index 5140f72b3ce..4425d87e2b0 100644
--- a/src/test/ui/error-codes/E0110.stderr
+++ b/src/test/ui/error-codes/E0110.stderr
@@ -1,8 +1,10 @@
-error[E0109]: lifetime arguments are not allowed for this type
+error[E0109]: lifetime arguments are not allowed on this type
   --> $DIR/E0110.rs:1:14
    |
 LL | type X = u32<'static>;
-   |              ^^^^^^^ lifetime argument not allowed
+   |          --- ^^^^^^^ lifetime argument not allowed
+   |          |
+   |          not allowed on this
    |
 help: primitive type `u32` doesn't have type parameters
    |
diff --git a/src/test/ui/issues/issue-22706.rs b/src/test/ui/issues/issue-22706.rs
index 28e8a722804..bb8a58d3d2e 100644
--- a/src/test/ui/issues/issue-22706.rs
+++ b/src/test/ui/issues/issue-22706.rs
@@ -1,3 +1,3 @@
 fn is_copy<T: ::std::marker<i32>::Copy>() {}
-//~^ ERROR type arguments are not allowed for this type [E0109]
+//~^ ERROR type arguments are not allowed on module `marker` [E0109]
 fn main() {}
diff --git a/src/test/ui/issues/issue-22706.stderr b/src/test/ui/issues/issue-22706.stderr
index c5929397f65..66911f081d7 100644
--- a/src/test/ui/issues/issue-22706.stderr
+++ b/src/test/ui/issues/issue-22706.stderr
@@ -1,8 +1,10 @@
-error[E0109]: type arguments are not allowed for this type
+error[E0109]: type arguments are not allowed on module `marker`
   --> $DIR/issue-22706.rs:1:29
    |
 LL | fn is_copy<T: ::std::marker<i32>::Copy>() {}
-   |                             ^^^ type argument not allowed
+   |                      ------ ^^^ type argument not allowed
+   |                      |
+   |                      not allowed on this
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/issues/issue-57924.rs b/src/test/ui/issues/issue-57924.rs
index dc2942225e3..8846912a8ff 100644
--- a/src/test/ui/issues/issue-57924.rs
+++ b/src/test/ui/issues/issue-57924.rs
@@ -3,7 +3,7 @@ pub struct Gcm<E>(E);
 impl<E> Gcm<E> {
     pub fn crash(e: E) -> Self {
         Self::<E>(e)
-        //~^ ERROR type arguments are not allowed for this type
+        //~^ ERROR type arguments are not allowed on self constructor
     }
 }
 
diff --git a/src/test/ui/issues/issue-57924.stderr b/src/test/ui/issues/issue-57924.stderr
index 2f184b1aae1..211b0dde48c 100644
--- a/src/test/ui/issues/issue-57924.stderr
+++ b/src/test/ui/issues/issue-57924.stderr
@@ -1,8 +1,10 @@
-error[E0109]: type arguments are not allowed for this type
+error[E0109]: type arguments are not allowed on self constructor
   --> $DIR/issue-57924.rs:5:16
    |
 LL |         Self::<E>(e)
-   |                ^ type argument not allowed
+   |         ----   ^ type argument not allowed
+   |         |
+   |         not allowed on this
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/issues/issue-60989.rs b/src/test/ui/issues/issue-60989.rs
index 6dae1e1347b..29db3fdb471 100644
--- a/src/test/ui/issues/issue-60989.rs
+++ b/src/test/ui/issues/issue-60989.rs
@@ -10,9 +10,9 @@ impl From<A> for B {
 fn main() {
     let c1 = ();
     c1::<()>;
-    //~^ ERROR type arguments are not allowed for this type
+    //~^ ERROR type arguments are not allowed on local variable
 
     let c1 = A {};
     c1::<dyn Into<B>>;
-    //~^ ERROR type arguments are not allowed for this type
+    //~^ ERROR type arguments are not allowed on local variable
 }
diff --git a/src/test/ui/issues/issue-60989.stderr b/src/test/ui/issues/issue-60989.stderr
index 5d2d9e83c9b..9076f4f9385 100644
--- a/src/test/ui/issues/issue-60989.stderr
+++ b/src/test/ui/issues/issue-60989.stderr
@@ -1,14 +1,18 @@
-error[E0109]: type arguments are not allowed for this type
+error[E0109]: type arguments are not allowed on local variable
   --> $DIR/issue-60989.rs:12:10
    |
 LL |     c1::<()>;
-   |          ^^ type argument not allowed
+   |     --   ^^ type argument not allowed
+   |     |
+   |     not allowed on this
 
-error[E0109]: type arguments are not allowed for this type
+error[E0109]: type arguments are not allowed on local variable
   --> $DIR/issue-60989.rs:16:10
    |
 LL |     c1::<dyn Into<B>>;
-   |          ^^^^^^^^^^^ type argument not allowed
+   |     --   ^^^^^^^^^^^ type argument not allowed
+   |     |
+   |     not allowed on this
 
 error: aborting due to 2 previous errors
 
diff --git a/src/test/ui/mod-subitem-as-enum-variant.rs b/src/test/ui/mod-subitem-as-enum-variant.rs
index 9328d1a9045..959024c46f4 100644
--- a/src/test/ui/mod-subitem-as-enum-variant.rs
+++ b/src/test/ui/mod-subitem-as-enum-variant.rs
@@ -5,5 +5,5 @@ mod Mod {
 fn main() {
     Mod::FakeVariant::<i32>(0);
     Mod::<i32>::FakeVariant(0);
-    //~^ ERROR type arguments are not allowed for this type [E0109]
+    //~^ ERROR type arguments are not allowed on module `Mod` [E0109]
 }
diff --git a/src/test/ui/mod-subitem-as-enum-variant.stderr b/src/test/ui/mod-subitem-as-enum-variant.stderr
index d6815c91e5e..15da1d155a3 100644
--- a/src/test/ui/mod-subitem-as-enum-variant.stderr
+++ b/src/test/ui/mod-subitem-as-enum-variant.stderr
@@ -1,8 +1,10 @@
-error[E0109]: type arguments are not allowed for this type
+error[E0109]: type arguments are not allowed on module `Mod`
   --> $DIR/mod-subitem-as-enum-variant.rs:7:11
    |
 LL |     Mod::<i32>::FakeVariant(0);
-   |           ^^^ type argument not allowed
+   |     ---   ^^^ type argument not allowed
+   |     |
+   |     not allowed on this
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/structs/struct-path-associated-type.rs b/src/test/ui/structs/struct-path-associated-type.rs
index e44a203b783..f88572f8419 100644
--- a/src/test/ui/structs/struct-path-associated-type.rs
+++ b/src/test/ui/structs/struct-path-associated-type.rs
@@ -13,7 +13,7 @@ fn f<T: Tr>() {
     //~^ ERROR expected struct, variant or union type, found associated type
     let z = T::A::<u8> {};
     //~^ ERROR expected struct, variant or union type, found associated type
-    //~| ERROR type arguments are not allowed for this type
+    //~| ERROR type arguments are not allowed on this type
     match S {
         T::A {} => {}
         //~^ ERROR expected struct, variant or union type, found associated type
@@ -22,7 +22,7 @@ fn f<T: Tr>() {
 
 fn g<T: Tr<A = S>>() {
     let s = T::A {}; // OK
-    let z = T::A::<u8> {}; //~ ERROR type arguments are not allowed for this type
+    let z = T::A::<u8> {}; //~ ERROR type arguments are not allowed on this type
     match S {
         T::A {} => {} // OK
     }
diff --git a/src/test/ui/structs/struct-path-associated-type.stderr b/src/test/ui/structs/struct-path-associated-type.stderr
index 0b1b6a5e3af..7424ceecbe3 100644
--- a/src/test/ui/structs/struct-path-associated-type.stderr
+++ b/src/test/ui/structs/struct-path-associated-type.stderr
@@ -4,11 +4,13 @@ error[E0071]: expected struct, variant or union type, found associated type
 LL |     let s = T::A {};
    |             ^^^^ not a struct
 
-error[E0109]: type arguments are not allowed for this type
+error[E0109]: type arguments are not allowed on this type
   --> $DIR/struct-path-associated-type.rs:14:20
    |
 LL |     let z = T::A::<u8> {};
-   |                    ^^ type argument not allowed
+   |                -   ^^ type argument not allowed
+   |                |
+   |                not allowed on this
 
 error[E0071]: expected struct, variant or union type, found associated type
   --> $DIR/struct-path-associated-type.rs:14:13
@@ -22,11 +24,13 @@ error[E0071]: expected struct, variant or union type, found associated type
 LL |         T::A {} => {}
    |         ^^^^ not a struct
 
-error[E0109]: type arguments are not allowed for this type
+error[E0109]: type arguments are not allowed on this type
   --> $DIR/struct-path-associated-type.rs:25:20
    |
 LL |     let z = T::A::<u8> {};
-   |                    ^^ type argument not allowed
+   |                -   ^^ type argument not allowed
+   |                |
+   |                not allowed on this
 
 error[E0223]: ambiguous associated type
   --> $DIR/struct-path-associated-type.rs:32:13
diff --git a/src/test/ui/structs/struct-path-self.rs b/src/test/ui/structs/struct-path-self.rs
index c938ce8dad9..6e529c7ed2b 100644
--- a/src/test/ui/structs/struct-path-self.rs
+++ b/src/test/ui/structs/struct-path-self.rs
@@ -6,7 +6,7 @@ trait Tr {
         //~^ ERROR expected struct, variant or union type, found type parameter
         let z = Self::<u8> {};
         //~^ ERROR expected struct, variant or union type, found type parameter
-        //~| ERROR type arguments are not allowed for this type
+        //~| ERROR type arguments are not allowed on self type
         match s {
             Self { .. } => {}
             //~^ ERROR expected struct, variant or union type, found type parameter
@@ -17,7 +17,7 @@ trait Tr {
 impl Tr for S {
     fn f() {
         let s = Self {}; // OK
-        let z = Self::<u8> {}; //~ ERROR type arguments are not allowed for this type
+        let z = Self::<u8> {}; //~ ERROR type arguments are not allowed on self type
         match s {
             Self { .. } => {} // OK
         }
@@ -27,7 +27,7 @@ impl Tr for S {
 impl S {
     fn g() {
         let s = Self {}; // OK
-        let z = Self::<u8> {}; //~ ERROR type arguments are not allowed for this type
+        let z = Self::<u8> {}; //~ ERROR type arguments are not allowed on self type
         match s {
             Self { .. } => {} // OK
         }
diff --git a/src/test/ui/structs/struct-path-self.stderr b/src/test/ui/structs/struct-path-self.stderr
index 37384e56bc9..3a4baeb9f6c 100644
--- a/src/test/ui/structs/struct-path-self.stderr
+++ b/src/test/ui/structs/struct-path-self.stderr
@@ -4,11 +4,13 @@ error[E0071]: expected struct, variant or union type, found type parameter `Self
 LL |         let s = Self {};
    |                 ^^^^ not a struct
 
-error[E0109]: type arguments are not allowed for this type
+error[E0109]: type arguments are not allowed on self type
   --> $DIR/struct-path-self.rs:7:24
    |
 LL |         let z = Self::<u8> {};
-   |                        ^^ type argument not allowed
+   |                 ----   ^^ type argument not allowed
+   |                 |
+   |                 not allowed on this
    |
 help: the `Self` type doesn't accept type parameters
    |
@@ -28,11 +30,13 @@ error[E0071]: expected struct, variant or union type, found type parameter `Self
 LL |             Self { .. } => {}
    |             ^^^^ not a struct
 
-error[E0109]: type arguments are not allowed for this type
+error[E0109]: type arguments are not allowed on self type
   --> $DIR/struct-path-self.rs:20:24
    |
 LL |         let z = Self::<u8> {};
-   |                        ^^ type argument not allowed
+   |                 ----   ^^ type argument not allowed
+   |                 |
+   |                 not allowed on this
    |
 note: `Self` is of type `S`
   --> $DIR/struct-path-self.rs:1:8
@@ -48,11 +52,13 @@ LL -         let z = Self::<u8> {};
 LL +         let z = Self {};
    | 
 
-error[E0109]: type arguments are not allowed for this type
+error[E0109]: type arguments are not allowed on self type
   --> $DIR/struct-path-self.rs:30:24
    |
 LL |         let z = Self::<u8> {};
-   |                        ^^ type argument not allowed
+   |                 ----   ^^ type argument not allowed
+   |                 |
+   |                 not allowed on this
    |
 note: `Self` is of type `S`
   --> $DIR/struct-path-self.rs:1:8
diff --git a/src/test/ui/type-alias-enum-variants/enum-variant-generic-args.rs b/src/test/ui/type-alias-enum-variants/enum-variant-generic-args.rs
index 6bc4f528faa..e6f45036f85 100644
--- a/src/test/ui/type-alias-enum-variants/enum-variant-generic-args.rs
+++ b/src/test/ui/type-alias-enum-variants/enum-variant-generic-args.rs
@@ -13,38 +13,38 @@ impl<T> Enum<T> {
         Self::TSVariant(());
         //~^ ERROR mismatched types [E0308]
         Self::TSVariant::<()>(());
-        //~^ ERROR type arguments are not allowed for this type [E0109]
+        //~^ ERROR type arguments are not allowed on this type [E0109]
         Self::<()>::TSVariant(());
-        //~^ ERROR type arguments are not allowed for this type [E0109]
+        //~^ ERROR type arguments are not allowed on self type [E0109]
         //~| ERROR mismatched types [E0308]
         Self::<()>::TSVariant::<()>(());
-        //~^ ERROR type arguments are not allowed for this type [E0109]
-        //~| ERROR type arguments are not allowed for this type [E0109]
+        //~^ ERROR type arguments are not allowed on self type [E0109]
+        //~| ERROR type arguments are not allowed on this type [E0109]
     }
 
     fn s_variant() {
         Self::SVariant { v: () };
         //~^ ERROR mismatched types [E0308]
         Self::SVariant::<()> { v: () };
-        //~^ ERROR type arguments are not allowed for this type [E0109]
+        //~^ ERROR type arguments are not allowed on this type [E0109]
         //~| ERROR mismatched types [E0308]
         Self::<()>::SVariant { v: () };
-        //~^ ERROR type arguments are not allowed for this type [E0109]
+        //~^ ERROR type arguments are not allowed on self type [E0109]
         //~| ERROR mismatched types [E0308]
         Self::<()>::SVariant::<()> { v: () };
-        //~^ ERROR type arguments are not allowed for this type [E0109]
-        //~| ERROR type arguments are not allowed for this type [E0109]
+        //~^ ERROR type arguments are not allowed on self type [E0109]
+        //~| ERROR type arguments are not allowed on this type [E0109]
         //~| ERROR mismatched types [E0308]
     }
 
     fn u_variant() {
         Self::UVariant::<()>;
-        //~^ ERROR type arguments are not allowed for this type [E0109]
+        //~^ ERROR type arguments are not allowed on this type [E0109]
         Self::<()>::UVariant;
-        //~^ ERROR type arguments are not allowed for this type [E0109]
+        //~^ ERROR type arguments are not allowed on self type [E0109]
         Self::<()>::UVariant::<()>;
-        //~^ ERROR type arguments are not allowed for this type [E0109]
-        //~| ERROR type arguments are not allowed for this type [E0109]
+        //~^ ERROR type arguments are not allowed on self type [E0109]
+        //~| ERROR type arguments are not allowed on this type [E0109]
     }
 }
 
@@ -52,54 +52,54 @@ fn main() {
     // Tuple struct variant
 
     Enum::<()>::TSVariant::<()>(());
-    //~^ ERROR type arguments are not allowed for this type [E0109]
+    //~^ ERROR type arguments are not allowed on this type [E0109]
 
     Alias::TSVariant::<()>(());
-    //~^ ERROR type arguments are not allowed for this type [E0109]
+    //~^ ERROR type arguments are not allowed on this type [E0109]
     Alias::<()>::TSVariant::<()>(());
-    //~^ ERROR type arguments are not allowed for this type [E0109]
+    //~^ ERROR type arguments are not allowed on this type [E0109]
 
     AliasFixed::TSVariant::<()>(());
-    //~^ ERROR type arguments are not allowed for this type [E0109]
+    //~^ ERROR type arguments are not allowed on this type [E0109]
     AliasFixed::<()>::TSVariant(());
     //~^ ERROR this type alias takes 0 generic arguments but 1 generic argument was supplied [E0107]
     AliasFixed::<()>::TSVariant::<()>(());
-    //~^ ERROR type arguments are not allowed for this type [E0109]
+    //~^ ERROR type arguments are not allowed on this type [E0109]
     //~| ERROR this type alias takes 0 generic arguments but 1 generic argument was supplied [E0107]
 
     // Struct variant
 
     Enum::<()>::SVariant::<()> { v: () };
-    //~^ ERROR type arguments are not allowed for this type [E0109]
+    //~^ ERROR type arguments are not allowed on this type [E0109]
 
     Alias::SVariant::<()> { v: () };
-    //~^ ERROR type arguments are not allowed for this type [E0109]
+    //~^ ERROR type arguments are not allowed on this type [E0109]
     Alias::<()>::SVariant::<()> { v: () };
-    //~^ ERROR type arguments are not allowed for this type [E0109]
+    //~^ ERROR type arguments are not allowed on this type [E0109]
 
     AliasFixed::SVariant::<()> { v: () };
-    //~^ ERROR type arguments are not allowed for this type [E0109]
+    //~^ ERROR type arguments are not allowed on this type [E0109]
     AliasFixed::<()>::SVariant { v: () };
     //~^ ERROR this type alias takes 0 generic arguments but 1 generic argument was supplied [E0107]
     AliasFixed::<()>::SVariant::<()> { v: () };
-    //~^ ERROR type arguments are not allowed for this type [E0109]
+    //~^ ERROR type arguments are not allowed on this type [E0109]
     //~| ERROR this type alias takes 0 generic arguments but 1 generic argument was supplied [E0107]
 
     // Unit variant
 
     Enum::<()>::UVariant::<()>;
-    //~^ ERROR type arguments are not allowed for this type [E0109]
+    //~^ ERROR type arguments are not allowed on this type [E0109]
 
     Alias::UVariant::<()>;
-    //~^ ERROR type arguments are not allowed for this type [E0109]
+    //~^ ERROR type arguments are not allowed on this type [E0109]
     Alias::<()>::UVariant::<()>;
-    //~^ ERROR type arguments are not allowed for this type [E0109]
+    //~^ ERROR type arguments are not allowed on this type [E0109]
 
     AliasFixed::UVariant::<()>;
-    //~^ ERROR type arguments are not allowed for this type [E0109]
+    //~^ ERROR type arguments are not allowed on this type [E0109]
     AliasFixed::<()>::UVariant;
     //~^ ERROR this type alias takes 0 generic arguments but 1 generic argument was supplied [E0107]
     AliasFixed::<()>::UVariant::<()>;
-    //~^ ERROR type arguments are not allowed for this type [E0109]
+    //~^ ERROR type arguments are not allowed on this type [E0109]
     //~| ERROR this type alias takes 0 generic arguments but 1 generic argument was supplied [E0107]
 }
diff --git a/src/test/ui/type-alias-enum-variants/enum-variant-generic-args.stderr b/src/test/ui/type-alias-enum-variants/enum-variant-generic-args.stderr
index b1b0ec99999..3e60ab108a8 100644
--- a/src/test/ui/type-alias-enum-variants/enum-variant-generic-args.stderr
+++ b/src/test/ui/type-alias-enum-variants/enum-variant-generic-args.stderr
@@ -17,17 +17,21 @@ note: tuple variant defined here
 LL | enum Enum<T> { TSVariant(T), SVariant { v: T }, UVariant }
    |                ^^^^^^^^^
 
-error[E0109]: type arguments are not allowed for this type
+error[E0109]: type arguments are not allowed on this type
   --> $DIR/enum-variant-generic-args.rs:15:27
    |
 LL |         Self::TSVariant::<()>(());
-   |                           ^^ type argument not allowed
+   |               ---------   ^^ type argument not allowed
+   |               |
+   |               not allowed on this
 
-error[E0109]: type arguments are not allowed for this type
+error[E0109]: type arguments are not allowed on self type
   --> $DIR/enum-variant-generic-args.rs:17:16
    |
 LL |         Self::<()>::TSVariant(());
-   |                ^^ type argument not allowed
+   |         ----   ^^ type argument not allowed
+   |         |
+   |         not allowed on this
    |
 note: `Self` is of type `Enum<T>`
   --> $DIR/enum-variant-generic-args.rs:7:6
@@ -61,11 +65,13 @@ note: tuple variant defined here
 LL | enum Enum<T> { TSVariant(T), SVariant { v: T }, UVariant }
    |                ^^^^^^^^^
 
-error[E0109]: type arguments are not allowed for this type
+error[E0109]: type arguments are not allowed on self type
   --> $DIR/enum-variant-generic-args.rs:20:16
    |
 LL |         Self::<()>::TSVariant::<()>(());
-   |                ^^ type argument not allowed
+   |         ----   ^^ type argument not allowed
+   |         |
+   |         not allowed on this
    |
 note: `Self` is of type `Enum<T>`
   --> $DIR/enum-variant-generic-args.rs:7:6
@@ -80,11 +86,13 @@ help: the `Self` type doesn't accept type parameters, use the concrete type's na
 LL |         Enum::<()>::TSVariant::<()>(());
    |         ~~~~
 
-error[E0109]: type arguments are not allowed for this type
+error[E0109]: type arguments are not allowed on this type
   --> $DIR/enum-variant-generic-args.rs:20:33
    |
 LL |         Self::<()>::TSVariant::<()>(());
-   |                                 ^^ type argument not allowed
+   |                     ---------   ^^ type argument not allowed
+   |                     |
+   |                     not allowed on this
 
 error[E0308]: mismatched types
   --> $DIR/enum-variant-generic-args.rs:26:29
@@ -98,11 +106,13 @@ LL |         Self::SVariant { v: () };
    = note: expected type parameter `T`
                    found unit type `()`
 
-error[E0109]: type arguments are not allowed for this type
+error[E0109]: type arguments are not allowed on this type
   --> $DIR/enum-variant-generic-args.rs:28:26
    |
 LL |         Self::SVariant::<()> { v: () };
-   |                          ^^ type argument not allowed
+   |               --------   ^^ type argument not allowed
+   |               |
+   |               not allowed on this
    |
    = note: enum variants can't have type parameters
 help: you might have meant to specity type parameters on enum `Enum`
@@ -123,11 +133,13 @@ LL |         Self::SVariant::<()> { v: () };
    = note: expected type parameter `T`
                    found unit type `()`
 
-error[E0109]: type arguments are not allowed for this type
+error[E0109]: type arguments are not allowed on self type
   --> $DIR/enum-variant-generic-args.rs:31:16
    |
 LL |         Self::<()>::SVariant { v: () };
-   |                ^^ type argument not allowed
+   |         ----   ^^ type argument not allowed
+   |         |
+   |         not allowed on this
    |
 note: `Self` is of type `Enum<T>`
   --> $DIR/enum-variant-generic-args.rs:7:6
@@ -154,11 +166,13 @@ LL |         Self::<()>::SVariant { v: () };
    = note: expected type parameter `T`
                    found unit type `()`
 
-error[E0109]: type arguments are not allowed for this type
+error[E0109]: type arguments are not allowed on self type
   --> $DIR/enum-variant-generic-args.rs:34:16
    |
 LL |         Self::<()>::SVariant::<()> { v: () };
-   |                ^^ type argument not allowed
+   |         ----   ^^ type argument not allowed
+   |         |
+   |         not allowed on this
    |
 note: `Self` is of type `Enum<T>`
   --> $DIR/enum-variant-generic-args.rs:7:6
@@ -173,11 +187,13 @@ help: the `Self` type doesn't accept type parameters, use the concrete type's na
 LL |         Enum::<()>::SVariant::<()> { v: () };
    |         ~~~~
 
-error[E0109]: type arguments are not allowed for this type
+error[E0109]: type arguments are not allowed on this type
   --> $DIR/enum-variant-generic-args.rs:34:32
    |
 LL |         Self::<()>::SVariant::<()> { v: () };
-   |                                ^^ type argument not allowed
+   |                     --------   ^^ type argument not allowed
+   |                     |
+   |                     not allowed on this
    |
    = note: enum variants can't have type parameters
 help: you might have meant to specity type parameters on enum `Enum`
@@ -198,17 +214,21 @@ LL |         Self::<()>::SVariant::<()> { v: () };
    = note: expected type parameter `T`
                    found unit type `()`
 
-error[E0109]: type arguments are not allowed for this type
+error[E0109]: type arguments are not allowed on this type
   --> $DIR/enum-variant-generic-args.rs:41:26
    |
 LL |         Self::UVariant::<()>;
-   |                          ^^ type argument not allowed
+   |               --------   ^^ type argument not allowed
+   |               |
+   |               not allowed on this
 
-error[E0109]: type arguments are not allowed for this type
+error[E0109]: type arguments are not allowed on self type
   --> $DIR/enum-variant-generic-args.rs:43:16
    |
 LL |         Self::<()>::UVariant;
-   |                ^^ type argument not allowed
+   |         ----   ^^ type argument not allowed
+   |         |
+   |         not allowed on this
    |
 note: `Self` is of type `Enum<T>`
   --> $DIR/enum-variant-generic-args.rs:7:6
@@ -223,11 +243,13 @@ help: the `Self` type doesn't accept type parameters, use the concrete type's na
 LL |         Enum::<()>::UVariant;
    |         ~~~~
 
-error[E0109]: type arguments are not allowed for this type
+error[E0109]: type arguments are not allowed on self type
   --> $DIR/enum-variant-generic-args.rs:45:16
    |
 LL |         Self::<()>::UVariant::<()>;
-   |                ^^ type argument not allowed
+   |         ----   ^^ type argument not allowed
+   |         |
+   |         not allowed on this
    |
 note: `Self` is of type `Enum<T>`
   --> $DIR/enum-variant-generic-args.rs:7:6
@@ -242,35 +264,45 @@ help: the `Self` type doesn't accept type parameters, use the concrete type's na
 LL |         Enum::<()>::UVariant::<()>;
    |         ~~~~
 
-error[E0109]: type arguments are not allowed for this type
+error[E0109]: type arguments are not allowed on this type
   --> $DIR/enum-variant-generic-args.rs:45:32
    |
 LL |         Self::<()>::UVariant::<()>;
-   |                                ^^ type argument not allowed
+   |                     --------   ^^ type argument not allowed
+   |                     |
+   |                     not allowed on this
 
-error[E0109]: type arguments are not allowed for this type
+error[E0109]: type arguments are not allowed on this type
   --> $DIR/enum-variant-generic-args.rs:54:29
    |
 LL |     Enum::<()>::TSVariant::<()>(());
-   |                             ^^ type argument not allowed
+   |                 ---------   ^^ type argument not allowed
+   |                 |
+   |                 not allowed on this
 
-error[E0109]: type arguments are not allowed for this type
+error[E0109]: type arguments are not allowed on this type
   --> $DIR/enum-variant-generic-args.rs:57:24
    |
 LL |     Alias::TSVariant::<()>(());
-   |                        ^^ type argument not allowed
+   |            ---------   ^^ type argument not allowed
+   |            |
+   |            not allowed on this
 
-error[E0109]: type arguments are not allowed for this type
+error[E0109]: type arguments are not allowed on this type
   --> $DIR/enum-variant-generic-args.rs:59:30
    |
 LL |     Alias::<()>::TSVariant::<()>(());
-   |                              ^^ type argument not allowed
+   |                  ---------   ^^ type argument not allowed
+   |                  |
+   |                  not allowed on this
 
-error[E0109]: type arguments are not allowed for this type
+error[E0109]: type arguments are not allowed on this type
   --> $DIR/enum-variant-generic-args.rs:62:29
    |
 LL |     AliasFixed::TSVariant::<()>(());
-   |                             ^^ type argument not allowed
+   |                 ---------   ^^ type argument not allowed
+   |                 |
+   |                 not allowed on this
 
 error[E0107]: this type alias takes 0 generic arguments but 1 generic argument was supplied
   --> $DIR/enum-variant-generic-args.rs:64:5
@@ -300,25 +332,31 @@ note: type alias defined here, with 0 generic parameters
 LL | type AliasFixed = Enum<()>;
    |      ^^^^^^^^^^
 
-error[E0109]: type arguments are not allowed for this type
+error[E0109]: type arguments are not allowed on this type
   --> $DIR/enum-variant-generic-args.rs:66:35
    |
 LL |     AliasFixed::<()>::TSVariant::<()>(());
-   |                                   ^^ type argument not allowed
+   |                       ---------   ^^ type argument not allowed
+   |                       |
+   |                       not allowed on this
 
-error[E0109]: type arguments are not allowed for this type
+error[E0109]: type arguments are not allowed on this type
   --> $DIR/enum-variant-generic-args.rs:72:28
    |
 LL |     Enum::<()>::SVariant::<()> { v: () };
-   |                            ^^ type argument not allowed
+   |                 --------   ^^ type argument not allowed
+   |                 |
+   |                 not allowed on this
    |
    = note: enum variants can't have type parameters
 
-error[E0109]: type arguments are not allowed for this type
+error[E0109]: type arguments are not allowed on this type
   --> $DIR/enum-variant-generic-args.rs:75:23
    |
 LL |     Alias::SVariant::<()> { v: () };
-   |                       ^^ type argument not allowed
+   |            --------   ^^ type argument not allowed
+   |            |
+   |            not allowed on this
    |
    = note: enum variants can't have type parameters
 help: you might have meant to specity type parameters on enum `Enum`
@@ -327,11 +365,13 @@ LL -     Alias::SVariant::<()> { v: () };
 LL +     Alias::<()>::SVariant { v: () };
    | 
 
-error[E0109]: type arguments are not allowed for this type
+error[E0109]: type arguments are not allowed on this type
   --> $DIR/enum-variant-generic-args.rs:77:29
    |
 LL |     Alias::<()>::SVariant::<()> { v: () };
-   |                             ^^ type argument not allowed
+   |                  --------   ^^ type argument not allowed
+   |                  |
+   |                  not allowed on this
    |
    = note: enum variants can't have type parameters
 help: you might have meant to specity type parameters on enum `Enum`
@@ -340,11 +380,13 @@ LL -     Alias::<()>::SVariant::<()> { v: () };
 LL +     Alias::<()>::SVariant { v: () };
    | 
 
-error[E0109]: type arguments are not allowed for this type
+error[E0109]: type arguments are not allowed on this type
   --> $DIR/enum-variant-generic-args.rs:80:28
    |
 LL |     AliasFixed::SVariant::<()> { v: () };
-   |                            ^^ type argument not allowed
+   |                 --------   ^^ type argument not allowed
+   |                 |
+   |                 not allowed on this
    |
    = note: enum variants can't have type parameters
 help: you might have meant to specity type parameters on enum `Enum`
@@ -381,11 +423,13 @@ note: type alias defined here, with 0 generic parameters
 LL | type AliasFixed = Enum<()>;
    |      ^^^^^^^^^^
 
-error[E0109]: type arguments are not allowed for this type
+error[E0109]: type arguments are not allowed on this type
   --> $DIR/enum-variant-generic-args.rs:84:34
    |
 LL |     AliasFixed::<()>::SVariant::<()> { v: () };
-   |                                  ^^ type argument not allowed
+   |                       --------   ^^ type argument not allowed
+   |                       |
+   |                       not allowed on this
    |
    = note: enum variants can't have type parameters
 help: you might have meant to specity type parameters on enum `Enum`
@@ -394,29 +438,37 @@ LL -     AliasFixed::<()>::SVariant::<()> { v: () };
 LL +     AliasFixed::<()>::SVariant { v: () };
    | 
 
-error[E0109]: type arguments are not allowed for this type
+error[E0109]: type arguments are not allowed on this type
   --> $DIR/enum-variant-generic-args.rs:90:28
    |
 LL |     Enum::<()>::UVariant::<()>;
-   |                            ^^ type argument not allowed
+   |                 --------   ^^ type argument not allowed
+   |                 |
+   |                 not allowed on this
 
-error[E0109]: type arguments are not allowed for this type
+error[E0109]: type arguments are not allowed on this type
   --> $DIR/enum-variant-generic-args.rs:93:23
    |
 LL |     Alias::UVariant::<()>;
-   |                       ^^ type argument not allowed
+   |            --------   ^^ type argument not allowed
+   |            |
+   |            not allowed on this
 
-error[E0109]: type arguments are not allowed for this type
+error[E0109]: type arguments are not allowed on this type
   --> $DIR/enum-variant-generic-args.rs:95:29
    |
 LL |     Alias::<()>::UVariant::<()>;
-   |                             ^^ type argument not allowed
+   |                  --------   ^^ type argument not allowed
+   |                  |
+   |                  not allowed on this
 
-error[E0109]: type arguments are not allowed for this type
+error[E0109]: type arguments are not allowed on this type
   --> $DIR/enum-variant-generic-args.rs:98:28
    |
 LL |     AliasFixed::UVariant::<()>;
-   |                            ^^ type argument not allowed
+   |                 --------   ^^ type argument not allowed
+   |                 |
+   |                 not allowed on this
 
 error[E0107]: this type alias takes 0 generic arguments but 1 generic argument was supplied
   --> $DIR/enum-variant-generic-args.rs:100:5
@@ -446,11 +498,13 @@ note: type alias defined here, with 0 generic parameters
 LL | type AliasFixed = Enum<()>;
    |      ^^^^^^^^^^
 
-error[E0109]: type arguments are not allowed for this type
+error[E0109]: type arguments are not allowed on this type
   --> $DIR/enum-variant-generic-args.rs:102:34
    |
 LL |     AliasFixed::<()>::UVariant::<()>;
-   |                                  ^^ type argument not allowed
+   |                       --------   ^^ type argument not allowed
+   |                       |
+   |                       not allowed on this
 
 error: aborting due to 39 previous errors
 
diff --git a/src/test/ui/type-alias-enum-variants/no-type-application-on-aliased-enum-variant.rs b/src/test/ui/type-alias-enum-variants/no-type-application-on-aliased-enum-variant.rs
index c1153fa4dc7..872ece0c0f9 100644
--- a/src/test/ui/type-alias-enum-variants/no-type-application-on-aliased-enum-variant.rs
+++ b/src/test/ui/type-alias-enum-variants/no-type-application-on-aliased-enum-variant.rs
@@ -10,5 +10,5 @@ fn main() {
     let _ = Option::<u8>::None; // OK
     let _ = Option::None::<u8>; // OK (Lint in future!)
     let _ = Alias::<u8>::None; // OK
-    let _ = Alias::None::<u8>; //~ ERROR type arguments are not allowed for this type
+    let _ = Alias::None::<u8>; //~ ERROR type arguments are not allowed on this type
 }
diff --git a/src/test/ui/type-alias-enum-variants/no-type-application-on-aliased-enum-variant.stderr b/src/test/ui/type-alias-enum-variants/no-type-application-on-aliased-enum-variant.stderr
index a1064d69251..474548a14a9 100644
--- a/src/test/ui/type-alias-enum-variants/no-type-application-on-aliased-enum-variant.stderr
+++ b/src/test/ui/type-alias-enum-variants/no-type-application-on-aliased-enum-variant.stderr
@@ -1,8 +1,10 @@
-error[E0109]: type arguments are not allowed for this type
+error[E0109]: type arguments are not allowed on this type
   --> $DIR/no-type-application-on-aliased-enum-variant.rs:13:27
    |
 LL |     let _ = Alias::None::<u8>;
-   |                           ^^ type argument not allowed
+   |                    ----   ^^ type argument not allowed
+   |                    |
+   |                    not allowed on this
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/type/issue-91268.rs b/src/test/ui/type/issue-91268.rs
index fd2733c1c54..01ed9ea9e23 100644
--- a/src/test/ui/type/issue-91268.rs
+++ b/src/test/ui/type/issue-91268.rs
@@ -1,7 +1,7 @@
 // error-pattern: this file contains an unclosed delimiter
 // error-pattern: cannot find type `ţ` in this scope
 // error-pattern: parenthesized type parameters may only be used with a `Fn` trait
-// error-pattern: type arguments are not allowed for this type
+// error-pattern: type arguments are not allowed on this type
 // error-pattern: mismatched types
 // ignore-tidy-trailing-newlines
 // `ţ` must be the last character in this file, it cannot be followed by a newline
diff --git a/src/test/ui/type/issue-91268.stderr b/src/test/ui/type/issue-91268.stderr
index 9e86fd3aa7d..b8900b02180 100644
--- a/src/test/ui/type/issue-91268.stderr
+++ b/src/test/ui/type/issue-91268.stderr
@@ -30,11 +30,13 @@ error[E0214]: parenthesized type parameters may only be used with a `Fn` trait
 LL |     0: u8(ţ
    |        ^^^^ only `Fn` traits may use parentheses
 
-error[E0109]: type arguments are not allowed for this type
+error[E0109]: type arguments are not allowed on this type
   --> $DIR/issue-91268.rs:9:11
    |
 LL |     0: u8(ţ
-   |           ^ type argument not allowed
+   |        -- ^ type argument not allowed
+   |        |
+   |        not allowed on this
    |
 help: primitive type `u8` doesn't have type parameters
    |
diff --git a/src/test/ui/typeck/prim-with-args.fixed b/src/test/ui/typeck/prim-with-args.fixed
index 0fd4a0f984e..1c5fd750867 100644
--- a/src/test/ui/typeck/prim-with-args.fixed
+++ b/src/test/ui/typeck/prim-with-args.fixed
@@ -1,28 +1,28 @@
 // run-rustfix
 fn main() {
 
-let _x: isize; //~ ERROR type arguments are not allowed for this type
-let _x: i8; //~ ERROR type arguments are not allowed for this type
-let _x: i16; //~ ERROR type arguments are not allowed for this type
-let _x: i32; //~ ERROR type arguments are not allowed for this type
-let _x: i64; //~ ERROR type arguments are not allowed for this type
-let _x: usize; //~ ERROR type arguments are not allowed for this type
-let _x: u8; //~ ERROR type arguments are not allowed for this type
-let _x: u16; //~ ERROR type arguments are not allowed for this type
-let _x: u32; //~ ERROR type arguments are not allowed for this type
-let _x: u64; //~ ERROR type arguments are not allowed for this type
-let _x: char; //~ ERROR type arguments are not allowed for this type
+let _x: isize; //~ ERROR type arguments are not allowed on this type
+let _x: i8; //~ ERROR type arguments are not allowed on this type
+let _x: i16; //~ ERROR type arguments are not allowed on this type
+let _x: i32; //~ ERROR type arguments are not allowed on this type
+let _x: i64; //~ ERROR type arguments are not allowed on this type
+let _x: usize; //~ ERROR type arguments are not allowed on this type
+let _x: u8; //~ ERROR type arguments are not allowed on this type
+let _x: u16; //~ ERROR type arguments are not allowed on this type
+let _x: u32; //~ ERROR type arguments are not allowed on this type
+let _x: u64; //~ ERROR type arguments are not allowed on this type
+let _x: char; //~ ERROR type arguments are not allowed on this type
 
-let _x: isize; //~ ERROR lifetime arguments are not allowed for this type
-let _x: i8; //~ ERROR lifetime arguments are not allowed for this type
-let _x: i16; //~ ERROR lifetime arguments are not allowed for this type
-let _x: i32; //~ ERROR lifetime arguments are not allowed for this type
-let _x: i64; //~ ERROR lifetime arguments are not allowed for this type
-let _x: usize; //~ ERROR lifetime arguments are not allowed for this type
-let _x: u8; //~ ERROR lifetime arguments are not allowed for this type
-let _x: u16; //~ ERROR lifetime arguments are not allowed for this type
-let _x: u32; //~ ERROR lifetime arguments are not allowed for this type
-let _x: u64; //~ ERROR lifetime arguments are not allowed for this type
-let _x: char; //~ ERROR lifetime arguments are not allowed for this type
+let _x: isize; //~ ERROR lifetime arguments are not allowed on this type
+let _x: i8; //~ ERROR lifetime arguments are not allowed on this type
+let _x: i16; //~ ERROR lifetime arguments are not allowed on this type
+let _x: i32; //~ ERROR lifetime arguments are not allowed on this type
+let _x: i64; //~ ERROR lifetime arguments are not allowed on this type
+let _x: usize; //~ ERROR lifetime arguments are not allowed on this type
+let _x: u8; //~ ERROR lifetime arguments are not allowed on this type
+let _x: u16; //~ ERROR lifetime arguments are not allowed on this type
+let _x: u32; //~ ERROR lifetime arguments are not allowed on this type
+let _x: u64; //~ ERROR lifetime arguments are not allowed on this type
+let _x: char; //~ ERROR lifetime arguments are not allowed on this type
 
 }
diff --git a/src/test/ui/typeck/prim-with-args.rs b/src/test/ui/typeck/prim-with-args.rs
index a21fe69dc6a..b05d6c1cb4e 100644
--- a/src/test/ui/typeck/prim-with-args.rs
+++ b/src/test/ui/typeck/prim-with-args.rs
@@ -1,28 +1,28 @@
 // run-rustfix
 fn main() {
 
-let _x: isize<isize>; //~ ERROR type arguments are not allowed for this type
-let _x: i8<isize>; //~ ERROR type arguments are not allowed for this type
-let _x: i16<isize>; //~ ERROR type arguments are not allowed for this type
-let _x: i32<isize>; //~ ERROR type arguments are not allowed for this type
-let _x: i64<isize>; //~ ERROR type arguments are not allowed for this type
-let _x: usize<isize>; //~ ERROR type arguments are not allowed for this type
-let _x: u8<isize>; //~ ERROR type arguments are not allowed for this type
-let _x: u16<isize>; //~ ERROR type arguments are not allowed for this type
-let _x: u32<isize>; //~ ERROR type arguments are not allowed for this type
-let _x: u64<isize>; //~ ERROR type arguments are not allowed for this type
-let _x: char<isize>; //~ ERROR type arguments are not allowed for this type
+let _x: isize<isize>; //~ ERROR type arguments are not allowed on this type
+let _x: i8<isize>; //~ ERROR type arguments are not allowed on this type
+let _x: i16<isize>; //~ ERROR type arguments are not allowed on this type
+let _x: i32<isize>; //~ ERROR type arguments are not allowed on this type
+let _x: i64<isize>; //~ ERROR type arguments are not allowed on this type
+let _x: usize<isize>; //~ ERROR type arguments are not allowed on this type
+let _x: u8<isize>; //~ ERROR type arguments are not allowed on this type
+let _x: u16<isize>; //~ ERROR type arguments are not allowed on this type
+let _x: u32<isize>; //~ ERROR type arguments are not allowed on this type
+let _x: u64<isize>; //~ ERROR type arguments are not allowed on this type
+let _x: char<isize>; //~ ERROR type arguments are not allowed on this type
 
-let _x: isize<'static>; //~ ERROR lifetime arguments are not allowed for this type
-let _x: i8<'static>; //~ ERROR lifetime arguments are not allowed for this type
-let _x: i16<'static>; //~ ERROR lifetime arguments are not allowed for this type
-let _x: i32<'static>; //~ ERROR lifetime arguments are not allowed for this type
-let _x: i64<'static>; //~ ERROR lifetime arguments are not allowed for this type
-let _x: usize<'static>; //~ ERROR lifetime arguments are not allowed for this type
-let _x: u8<'static>; //~ ERROR lifetime arguments are not allowed for this type
-let _x: u16<'static>; //~ ERROR lifetime arguments are not allowed for this type
-let _x: u32<'static>; //~ ERROR lifetime arguments are not allowed for this type
-let _x: u64<'static>; //~ ERROR lifetime arguments are not allowed for this type
-let _x: char<'static>; //~ ERROR lifetime arguments are not allowed for this type
+let _x: isize<'static>; //~ ERROR lifetime arguments are not allowed on this type
+let _x: i8<'static>; //~ ERROR lifetime arguments are not allowed on this type
+let _x: i16<'static>; //~ ERROR lifetime arguments are not allowed on this type
+let _x: i32<'static>; //~ ERROR lifetime arguments are not allowed on this type
+let _x: i64<'static>; //~ ERROR lifetime arguments are not allowed on this type
+let _x: usize<'static>; //~ ERROR lifetime arguments are not allowed on this type
+let _x: u8<'static>; //~ ERROR lifetime arguments are not allowed on this type
+let _x: u16<'static>; //~ ERROR lifetime arguments are not allowed on this type
+let _x: u32<'static>; //~ ERROR lifetime arguments are not allowed on this type
+let _x: u64<'static>; //~ ERROR lifetime arguments are not allowed on this type
+let _x: char<'static>; //~ ERROR lifetime arguments are not allowed on this type
 
 }
diff --git a/src/test/ui/typeck/prim-with-args.stderr b/src/test/ui/typeck/prim-with-args.stderr
index d7c32cf8ecf..1728757c808 100644
--- a/src/test/ui/typeck/prim-with-args.stderr
+++ b/src/test/ui/typeck/prim-with-args.stderr
@@ -1,8 +1,10 @@
-error[E0109]: type arguments are not allowed for this type
+error[E0109]: type arguments are not allowed on this type
   --> $DIR/prim-with-args.rs:4:15
    |
 LL | let _x: isize<isize>;
-   |               ^^^^^ type argument not allowed
+   |         ----- ^^^^^ type argument not allowed
+   |         |
+   |         not allowed on this
    |
 help: primitive type `isize` doesn't have type parameters
    |
@@ -10,11 +12,13 @@ LL - let _x: isize<isize>;
 LL + let _x: isize;
    | 
 
-error[E0109]: type arguments are not allowed for this type
+error[E0109]: type arguments are not allowed on this type
   --> $DIR/prim-with-args.rs:5:12
    |
 LL | let _x: i8<isize>;
-   |            ^^^^^ type argument not allowed
+   |         -- ^^^^^ type argument not allowed
+   |         |
+   |         not allowed on this
    |
 help: primitive type `i8` doesn't have type parameters
    |
@@ -22,11 +26,13 @@ LL - let _x: i8<isize>;
 LL + let _x: i8;
    | 
 
-error[E0109]: type arguments are not allowed for this type
+error[E0109]: type arguments are not allowed on this type
   --> $DIR/prim-with-args.rs:6:13
    |
 LL | let _x: i16<isize>;
-   |             ^^^^^ type argument not allowed
+   |         --- ^^^^^ type argument not allowed
+   |         |
+   |         not allowed on this
    |
 help: primitive type `i16` doesn't have type parameters
    |
@@ -34,11 +40,13 @@ LL - let _x: i16<isize>;
 LL + let _x: i16;
    | 
 
-error[E0109]: type arguments are not allowed for this type
+error[E0109]: type arguments are not allowed on this type
   --> $DIR/prim-with-args.rs:7:13
    |
 LL | let _x: i32<isize>;
-   |             ^^^^^ type argument not allowed
+   |         --- ^^^^^ type argument not allowed
+   |         |
+   |         not allowed on this
    |
 help: primitive type `i32` doesn't have type parameters
    |
@@ -46,11 +54,13 @@ LL - let _x: i32<isize>;
 LL + let _x: i32;
    | 
 
-error[E0109]: type arguments are not allowed for this type
+error[E0109]: type arguments are not allowed on this type
   --> $DIR/prim-with-args.rs:8:13
    |
 LL | let _x: i64<isize>;
-   |             ^^^^^ type argument not allowed
+   |         --- ^^^^^ type argument not allowed
+   |         |
+   |         not allowed on this
    |
 help: primitive type `i64` doesn't have type parameters
    |
@@ -58,11 +68,13 @@ LL - let _x: i64<isize>;
 LL + let _x: i64;
    | 
 
-error[E0109]: type arguments are not allowed for this type
+error[E0109]: type arguments are not allowed on this type
   --> $DIR/prim-with-args.rs:9:15
    |
 LL | let _x: usize<isize>;
-   |               ^^^^^ type argument not allowed
+   |         ----- ^^^^^ type argument not allowed
+   |         |
+   |         not allowed on this
    |
 help: primitive type `usize` doesn't have type parameters
    |
@@ -70,11 +82,13 @@ LL - let _x: usize<isize>;
 LL + let _x: usize;
    | 
 
-error[E0109]: type arguments are not allowed for this type
+error[E0109]: type arguments are not allowed on this type
   --> $DIR/prim-with-args.rs:10:12
    |
 LL | let _x: u8<isize>;
-   |            ^^^^^ type argument not allowed
+   |         -- ^^^^^ type argument not allowed
+   |         |
+   |         not allowed on this
    |
 help: primitive type `u8` doesn't have type parameters
    |
@@ -82,11 +96,13 @@ LL - let _x: u8<isize>;
 LL + let _x: u8;
    | 
 
-error[E0109]: type arguments are not allowed for this type
+error[E0109]: type arguments are not allowed on this type
   --> $DIR/prim-with-args.rs:11:13
    |
 LL | let _x: u16<isize>;
-   |             ^^^^^ type argument not allowed
+   |         --- ^^^^^ type argument not allowed
+   |         |
+   |         not allowed on this
    |
 help: primitive type `u16` doesn't have type parameters
    |
@@ -94,11 +110,13 @@ LL - let _x: u16<isize>;
 LL + let _x: u16;
    | 
 
-error[E0109]: type arguments are not allowed for this type
+error[E0109]: type arguments are not allowed on this type
   --> $DIR/prim-with-args.rs:12:13
    |
 LL | let _x: u32<isize>;
-   |             ^^^^^ type argument not allowed
+   |         --- ^^^^^ type argument not allowed
+   |         |
+   |         not allowed on this
    |
 help: primitive type `u32` doesn't have type parameters
    |
@@ -106,11 +124,13 @@ LL - let _x: u32<isize>;
 LL + let _x: u32;
    | 
 
-error[E0109]: type arguments are not allowed for this type
+error[E0109]: type arguments are not allowed on this type
   --> $DIR/prim-with-args.rs:13:13
    |
 LL | let _x: u64<isize>;
-   |             ^^^^^ type argument not allowed
+   |         --- ^^^^^ type argument not allowed
+   |         |
+   |         not allowed on this
    |
 help: primitive type `u64` doesn't have type parameters
    |
@@ -118,11 +138,13 @@ LL - let _x: u64<isize>;
 LL + let _x: u64;
    | 
 
-error[E0109]: type arguments are not allowed for this type
+error[E0109]: type arguments are not allowed on this type
   --> $DIR/prim-with-args.rs:14:14
    |
 LL | let _x: char<isize>;
-   |              ^^^^^ type argument not allowed
+   |         ---- ^^^^^ type argument not allowed
+   |         |
+   |         not allowed on this
    |
 help: primitive type `char` doesn't have type parameters
    |
@@ -130,11 +152,13 @@ LL - let _x: char<isize>;
 LL + let _x: char;
    | 
 
-error[E0109]: lifetime arguments are not allowed for this type
+error[E0109]: lifetime arguments are not allowed on this type
   --> $DIR/prim-with-args.rs:16:15
    |
 LL | let _x: isize<'static>;
-   |               ^^^^^^^ lifetime argument not allowed
+   |         ----- ^^^^^^^ lifetime argument not allowed
+   |         |
+   |         not allowed on this
    |
 help: primitive type `isize` doesn't have type parameters
    |
@@ -142,11 +166,13 @@ LL - let _x: isize<'static>;
 LL + let _x: isize;
    | 
 
-error[E0109]: lifetime arguments are not allowed for this type
+error[E0109]: lifetime arguments are not allowed on this type
   --> $DIR/prim-with-args.rs:17:12
    |
 LL | let _x: i8<'static>;
-   |            ^^^^^^^ lifetime argument not allowed
+   |         -- ^^^^^^^ lifetime argument not allowed
+   |         |
+   |         not allowed on this
    |
 help: primitive type `i8` doesn't have type parameters
    |
@@ -154,11 +180,13 @@ LL - let _x: i8<'static>;
 LL + let _x: i8;
    | 
 
-error[E0109]: lifetime arguments are not allowed for this type
+error[E0109]: lifetime arguments are not allowed on this type
   --> $DIR/prim-with-args.rs:18:13
    |
 LL | let _x: i16<'static>;
-   |             ^^^^^^^ lifetime argument not allowed
+   |         --- ^^^^^^^ lifetime argument not allowed
+   |         |
+   |         not allowed on this
    |
 help: primitive type `i16` doesn't have type parameters
    |
@@ -166,11 +194,13 @@ LL - let _x: i16<'static>;
 LL + let _x: i16;
    | 
 
-error[E0109]: lifetime arguments are not allowed for this type
+error[E0109]: lifetime arguments are not allowed on this type
   --> $DIR/prim-with-args.rs:19:13
    |
 LL | let _x: i32<'static>;
-   |             ^^^^^^^ lifetime argument not allowed
+   |         --- ^^^^^^^ lifetime argument not allowed
+   |         |
+   |         not allowed on this
    |
 help: primitive type `i32` doesn't have type parameters
    |
@@ -178,11 +208,13 @@ LL - let _x: i32<'static>;
 LL + let _x: i32;
    | 
 
-error[E0109]: lifetime arguments are not allowed for this type
+error[E0109]: lifetime arguments are not allowed on this type
   --> $DIR/prim-with-args.rs:20:13
    |
 LL | let _x: i64<'static>;
-   |             ^^^^^^^ lifetime argument not allowed
+   |         --- ^^^^^^^ lifetime argument not allowed
+   |         |
+   |         not allowed on this
    |
 help: primitive type `i64` doesn't have type parameters
    |
@@ -190,11 +222,13 @@ LL - let _x: i64<'static>;
 LL + let _x: i64;
    | 
 
-error[E0109]: lifetime arguments are not allowed for this type
+error[E0109]: lifetime arguments are not allowed on this type
   --> $DIR/prim-with-args.rs:21:15
    |
 LL | let _x: usize<'static>;
-   |               ^^^^^^^ lifetime argument not allowed
+   |         ----- ^^^^^^^ lifetime argument not allowed
+   |         |
+   |         not allowed on this
    |
 help: primitive type `usize` doesn't have type parameters
    |
@@ -202,11 +236,13 @@ LL - let _x: usize<'static>;
 LL + let _x: usize;
    | 
 
-error[E0109]: lifetime arguments are not allowed for this type
+error[E0109]: lifetime arguments are not allowed on this type
   --> $DIR/prim-with-args.rs:22:12
    |
 LL | let _x: u8<'static>;
-   |            ^^^^^^^ lifetime argument not allowed
+   |         -- ^^^^^^^ lifetime argument not allowed
+   |         |
+   |         not allowed on this
    |
 help: primitive type `u8` doesn't have type parameters
    |
@@ -214,11 +250,13 @@ LL - let _x: u8<'static>;
 LL + let _x: u8;
    | 
 
-error[E0109]: lifetime arguments are not allowed for this type
+error[E0109]: lifetime arguments are not allowed on this type
   --> $DIR/prim-with-args.rs:23:13
    |
 LL | let _x: u16<'static>;
-   |             ^^^^^^^ lifetime argument not allowed
+   |         --- ^^^^^^^ lifetime argument not allowed
+   |         |
+   |         not allowed on this
    |
 help: primitive type `u16` doesn't have type parameters
    |
@@ -226,11 +264,13 @@ LL - let _x: u16<'static>;
 LL + let _x: u16;
    | 
 
-error[E0109]: lifetime arguments are not allowed for this type
+error[E0109]: lifetime arguments are not allowed on this type
   --> $DIR/prim-with-args.rs:24:13
    |
 LL | let _x: u32<'static>;
-   |             ^^^^^^^ lifetime argument not allowed
+   |         --- ^^^^^^^ lifetime argument not allowed
+   |         |
+   |         not allowed on this
    |
 help: primitive type `u32` doesn't have type parameters
    |
@@ -238,11 +278,13 @@ LL - let _x: u32<'static>;
 LL + let _x: u32;
    | 
 
-error[E0109]: lifetime arguments are not allowed for this type
+error[E0109]: lifetime arguments are not allowed on this type
   --> $DIR/prim-with-args.rs:25:13
    |
 LL | let _x: u64<'static>;
-   |             ^^^^^^^ lifetime argument not allowed
+   |         --- ^^^^^^^ lifetime argument not allowed
+   |         |
+   |         not allowed on this
    |
 help: primitive type `u64` doesn't have type parameters
    |
@@ -250,11 +292,13 @@ LL - let _x: u64<'static>;
 LL + let _x: u64;
    | 
 
-error[E0109]: lifetime arguments are not allowed for this type
+error[E0109]: lifetime arguments are not allowed on this type
   --> $DIR/prim-with-args.rs:26:14
    |
 LL | let _x: char<'static>;
-   |              ^^^^^^^ lifetime argument not allowed
+   |         ---- ^^^^^^^ lifetime argument not allowed
+   |         |
+   |         not allowed on this
    |
 help: primitive type `char` doesn't have type parameters
    |
diff --git a/src/test/ui/usize-generic-argument-parent.rs b/src/test/ui/usize-generic-argument-parent.rs
index 46b06e2b366..6d17ba9b5b2 100644
--- a/src/test/ui/usize-generic-argument-parent.rs
+++ b/src/test/ui/usize-generic-argument-parent.rs
@@ -1,5 +1,5 @@
 fn foo() {
-    let x: usize<foo>; //~ ERROR const arguments are not allowed for this type
+    let x: usize<foo>; //~ ERROR const arguments are not allowed on this type
 }
 
 fn main() {}
diff --git a/src/test/ui/usize-generic-argument-parent.stderr b/src/test/ui/usize-generic-argument-parent.stderr
index 98505d7bbe8..e47de289d1e 100644
--- a/src/test/ui/usize-generic-argument-parent.stderr
+++ b/src/test/ui/usize-generic-argument-parent.stderr
@@ -1,8 +1,10 @@
-error[E0109]: const arguments are not allowed for this type
+error[E0109]: const arguments are not allowed on this type
   --> $DIR/usize-generic-argument-parent.rs:2:18
    |
 LL |     let x: usize<foo>;
-   |                  ^^^ const argument not allowed
+   |            ----- ^^^ const argument not allowed
+   |            |
+   |            not allowed on this
    |
 help: primitive type `usize` doesn't have type parameters
    |