about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorMazdak Farrokhzad <twingoow@gmail.com>2020-02-23 06:04:37 +0100
committerMazdak Farrokhzad <twingoow@gmail.com>2020-02-24 00:59:38 +0100
commitb01c1e2092b0d3c4e86aedf1e0875898fbde21e3 (patch)
treec45793911cee907f35ecd5ac94355c49ee062744 /src
parentab84914fe47aa2da615c9e759e686d1a45f8aae3 (diff)
downloadrust-b01c1e2092b0d3c4e86aedf1e0875898fbde21e3.tar.gz
rust-b01c1e2092b0d3c4e86aedf1e0875898fbde21e3.zip
parser: tweak item kind wording
Diffstat (limited to 'src')
-rw-r--r--src/librustc_expand/expand.rs4
-rw-r--r--src/librustc_hir/hir.rs10
-rw-r--r--src/librustc_parse/parser/item.rs20
-rw-r--r--src/librustc_passes/dead.rs8
-rw-r--r--src/librustc_passes/stability.rs2
-rw-r--r--src/libsyntax/ast.rs23
-rw-r--r--src/test/ui/parser/default-on-wrong-item-kind.rs72
-rw-r--r--src/test/ui/parser/default-on-wrong-item-kind.stderr72
-rw-r--r--src/test/ui/parser/mismatched-braces/missing-close-brace-in-impl-trait.rs4
-rw-r--r--src/test/ui/parser/mismatched-braces/missing-close-brace-in-impl-trait.stderr4
-rw-r--r--src/test/ui/parser/mismatched-braces/missing-close-brace-in-trait.rs4
-rw-r--r--src/test/ui/parser/mismatched-braces/missing-close-brace-in-trait.stderr4
12 files changed, 115 insertions, 112 deletions
diff --git a/src/librustc_expand/expand.rs b/src/librustc_expand/expand.rs
index e5f957a63de..fce2a1d7a7e 100644
--- a/src/librustc_expand/expand.rs
+++ b/src/librustc_expand/expand.rs
@@ -378,8 +378,8 @@ impl<'a, 'b> MacroExpander<'a, 'b> {
                 self.cx.span_err(
                     span,
                     &format!(
-                        "expected crate top-level item to be a module after macro expansion, found a {}",
-                        kind.descriptive_variant()
+                        "expected crate top-level item to be a module after macro expansion, found {} {}",
+                        kind.article(), kind.descr()
                     ),
                 );
             }
diff --git a/src/librustc_hir/hir.rs b/src/librustc_hir/hir.rs
index 8496a6ed23b..6d2f5ba6baf 100644
--- a/src/librustc_hir/hir.rs
+++ b/src/librustc_hir/hir.rs
@@ -2500,16 +2500,16 @@ pub enum ItemKind<'hir> {
 }
 
 impl ItemKind<'_> {
-    pub fn descriptive_variant(&self) -> &str {
+    pub fn descr(&self) -> &str {
         match *self {
             ItemKind::ExternCrate(..) => "extern crate",
-            ItemKind::Use(..) => "use",
+            ItemKind::Use(..) => "`use` import",
             ItemKind::Static(..) => "static item",
             ItemKind::Const(..) => "constant item",
             ItemKind::Fn(..) => "function",
             ItemKind::Mod(..) => "module",
-            ItemKind::ForeignMod(..) => "foreign module",
-            ItemKind::GlobalAsm(..) => "global asm",
+            ItemKind::ForeignMod(..) => "extern block",
+            ItemKind::GlobalAsm(..) => "global asm item",
             ItemKind::TyAlias(..) => "type alias",
             ItemKind::OpaqueTy(..) => "opaque type",
             ItemKind::Enum(..) => "enum",
@@ -2517,7 +2517,7 @@ impl ItemKind<'_> {
             ItemKind::Union(..) => "union",
             ItemKind::Trait(..) => "trait",
             ItemKind::TraitAlias(..) => "trait alias",
-            ItemKind::Impl { .. } => "impl",
+            ItemKind::Impl { .. } => "implementation",
         }
     }
 
diff --git a/src/librustc_parse/parser/item.rs b/src/librustc_parse/parser/item.rs
index d2073a5473a..0e0017d4ee5 100644
--- a/src/librustc_parse/parser/item.rs
+++ b/src/librustc_parse/parser/item.rs
@@ -661,12 +661,7 @@ impl<'a> Parser<'a> {
                     self.struct_span_err(span, "associated `static` items are not allowed").emit();
                     AssocItemKind::Const(a, b)
                 }
-                _ => {
-                    let span = self.sess.source_map().def_span(span);
-                    self.struct_span_err(span, "item kind not supported in `trait` or `impl`")
-                        .emit();
-                    return None;
-                }
+                _ => return self.error_bad_item_kind(span, &kind, "`trait` or `impl`"),
             };
             Some(P(Item { attrs, id, span, vis, ident, defaultness, kind, tokens }))
         }))
@@ -858,16 +853,19 @@ impl<'a> Parser<'a> {
                     self.error_on_foreign_const(span, ident);
                     ForeignItemKind::Static(a, Mutability::Not, b)
                 }
-                _ => {
-                    let span = self.sess.source_map().def_span(span);
-                    self.struct_span_err(span, "item kind not supported in `extern` block").emit();
-                    return None;
-                }
+                _ => return self.error_bad_item_kind(span, &kind, "`extern` block"),
             };
             Some(P(Item { attrs, id, span, vis, ident, defaultness, kind, tokens }))
         }))
     }
 
+    fn error_bad_item_kind<T>(&self, span: Span, kind: &ItemKind, ctx: &str) -> Option<T> {
+        let span = self.sess.source_map().def_span(span);
+        let msg = format!("{} not supported in {}", kind.descr(), ctx);
+        self.struct_span_err(span, &msg).emit();
+        return None;
+    }
+
     fn error_on_foreign_const(&self, span: Span, ident: Ident) {
         self.struct_span_err(ident.span, "extern items cannot be `const`")
             .span_suggestion(
diff --git a/src/librustc_passes/dead.rs b/src/librustc_passes/dead.rs
index 25b8b8fcd44..e0eef1db0f0 100644
--- a/src/librustc_passes/dead.rs
+++ b/src/librustc_passes/dead.rs
@@ -601,13 +601,7 @@ impl Visitor<'tcx> for DeadVisitor<'tcx> {
                 hir::ItemKind::Struct(..) => "constructed", // Issue #52325
                 _ => "used",
             };
-            self.warn_dead_code(
-                item.hir_id,
-                span,
-                item.ident.name,
-                item.kind.descriptive_variant(),
-                participle,
-            );
+            self.warn_dead_code(item.hir_id, span, item.ident.name, item.kind.descr(), participle);
         } else {
             // Only continue if we didn't warn
             intravisit::walk_item(self, item);
diff --git a/src/librustc_passes/stability.rs b/src/librustc_passes/stability.rs
index 0c7f64fefd0..99fbac4568e 100644
--- a/src/librustc_passes/stability.rs
+++ b/src/librustc_passes/stability.rs
@@ -362,7 +362,7 @@ impl<'a, 'tcx> Visitor<'tcx> for MissingStabilityAnnotations<'a, 'tcx> {
             // optional. They inherit stability from their parents when unannotated.
             hir::ItemKind::Impl { of_trait: None, .. } | hir::ItemKind::ForeignMod(..) => {}
 
-            _ => self.check_missing_stability(i.hir_id, i.span, i.kind.descriptive_variant()),
+            _ => self.check_missing_stability(i.hir_id, i.span, i.kind.descr()),
         }
 
         intravisit::walk_item(self, i)
diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs
index dd3319fcba1..f8a27cf7142 100644
--- a/src/libsyntax/ast.rs
+++ b/src/libsyntax/ast.rs
@@ -2574,23 +2574,34 @@ pub enum ItemKind {
 }
 
 impl ItemKind {
-    pub fn descriptive_variant(&self) -> &str {
-        match *self {
+    pub fn article(&self) -> &str {
+        use ItemKind::*;
+        match self {
+            Use(..) | Static(..) | Const(..) | Fn(..) | Mod(..) | GlobalAsm(..) | TyAlias(..)
+            | Struct(..) | Union(..) | Trait(..) | TraitAlias(..) | MacroDef(..) => "a",
+            ExternCrate(..) | ForeignMod(..) | Mac(..) | Enum(..) | Impl { .. } => "an",
+        }
+    }
+
+    pub fn descr(&self) -> &str {
+        match self {
             ItemKind::ExternCrate(..) => "extern crate",
-            ItemKind::Use(..) => "use",
+            ItemKind::Use(..) => "`use` import",
             ItemKind::Static(..) => "static item",
             ItemKind::Const(..) => "constant item",
             ItemKind::Fn(..) => "function",
             ItemKind::Mod(..) => "module",
-            ItemKind::ForeignMod(..) => "foreign module",
-            ItemKind::GlobalAsm(..) => "global asm",
+            ItemKind::ForeignMod(..) => "extern block",
+            ItemKind::GlobalAsm(..) => "global asm item",
             ItemKind::TyAlias(..) => "type alias",
             ItemKind::Enum(..) => "enum",
             ItemKind::Struct(..) => "struct",
             ItemKind::Union(..) => "union",
             ItemKind::Trait(..) => "trait",
             ItemKind::TraitAlias(..) => "trait alias",
-            ItemKind::Mac(..) | ItemKind::MacroDef(..) | ItemKind::Impl { .. } => "item",
+            ItemKind::Mac(..) => "item macro invocation",
+            ItemKind::MacroDef(..) => "macro definition",
+            ItemKind::Impl { .. } => "implementation",
         }
     }
 
diff --git a/src/test/ui/parser/default-on-wrong-item-kind.rs b/src/test/ui/parser/default-on-wrong-item-kind.rs
index 0951af1579b..47b9e34305f 100644
--- a/src/test/ui/parser/default-on-wrong-item-kind.rs
+++ b/src/test/ui/parser/default-on-wrong-item-kind.rs
@@ -31,110 +31,110 @@ mod free_items {
 #[cfg(FALSE)]
 extern "C" {
     default extern crate foo; //~ ERROR item cannot be `default`
-    //~^ ERROR item kind not supported in `extern` block
+    //~^ ERROR extern crate not supported in `extern` block
     default use foo; //~ ERROR item cannot be `default`
-    //~^ ERROR item kind not supported in `extern` block
+    //~^ ERROR `use` import not supported in `extern` block
     default static foo: u8; //~ ERROR item cannot be `default`
     default const foo: u8; //~ ERROR item cannot be `default`
     //~^ ERROR extern items cannot be `const`
     default fn foo(); //~ ERROR item cannot be `default`
     default mod foo {} //~ ERROR item cannot be `default`
-    //~^ ERROR item kind not supported in `extern` block
+    //~^ ERROR module not supported in `extern` block
     default extern "C" {} //~ ERROR item cannot be `default`
-    //~^ ERROR item kind not supported in `extern` block
+    //~^ ERROR extern block not supported in `extern` block
     default type foo = u8; //~ ERROR item cannot be `default`
     default enum foo {} //~ ERROR item cannot be `default`
-    //~^ ERROR item kind not supported in `extern` block
+    //~^ ERROR enum not supported in `extern` block
     default struct foo {} //~ ERROR item cannot be `default`
-    //~^ ERROR item kind not supported in `extern` block
+    //~^ ERROR struct not supported in `extern` block
     default union foo {} //~ ERROR item cannot be `default`
-    //~^ ERROR item kind not supported in `extern` block
+    //~^ ERROR union not supported in `extern` block
     default trait foo {} //~ ERROR item cannot be `default`
-    //~^ ERROR item kind not supported in `extern` block
+    //~^ ERROR trait not supported in `extern` block
     default trait foo = Ord; //~ ERROR item cannot be `default`
-    //~^ ERROR item kind not supported in `extern` block
+    //~^ ERROR trait alias not supported in `extern` block
     default impl foo {}
-    //~^ ERROR item kind not supported in `extern` block
+    //~^ ERROR implementation not supported in `extern` block
     default!();
     default::foo::bar!();
     default default!(); //~ ERROR item cannot be `default`
     default default::foo::bar!(); //~ ERROR item cannot be `default`
     default macro foo {} //~ ERROR item cannot be `default`
-    //~^ ERROR item kind not supported in `extern` block
+    //~^ ERROR macro definition not supported in `extern` block
     default macro_rules! foo {} //~ ERROR item cannot be `default`
-    //~^ ERROR item kind not supported in `extern` block
+    //~^ ERROR macro definition not supported in `extern` block
 }
 
 #[cfg(FALSE)]
 impl S {
     default extern crate foo;
-    //~^ ERROR item kind not supported in `trait` or `impl`
+    //~^ ERROR extern crate not supported in `trait` or `impl`
     default use foo;
-    //~^ ERROR item kind not supported in `trait` or `impl`
+    //~^ ERROR `use` import not supported in `trait` or `impl`
     default static foo: u8;
     //~^ ERROR associated `static` items are not allowed
     default const foo: u8;
     default fn foo();
     default mod foo {}
-    //~^ ERROR item kind not supported in `trait` or `impl`
+    //~^ ERROR module not supported in `trait` or `impl`
     default extern "C" {}
-    //~^ ERROR item kind not supported in `trait` or `impl`
+    //~^ ERROR extern block not supported in `trait` or `impl`
     default type foo = u8;
     default enum foo {}
-    //~^ ERROR item kind not supported in `trait` or `impl`
+    //~^ ERROR enum not supported in `trait` or `impl`
     default struct foo {}
-    //~^ ERROR item kind not supported in `trait` or `impl`
+    //~^ ERROR struct not supported in `trait` or `impl`
     default union foo {}
-    //~^ ERROR item kind not supported in `trait` or `impl`
+    //~^ ERROR union not supported in `trait` or `impl`
     default trait foo {}
-    //~^ ERROR item kind not supported in `trait` or `impl`
+    //~^ ERROR trait not supported in `trait` or `impl`
     default trait foo = Ord;
-    //~^ ERROR item kind not supported in `trait` or `impl`
+    //~^ ERROR trait alias not supported in `trait` or `impl`
     default impl foo {}
-    //~^ ERROR item kind not supported in `trait` or `impl`
+    //~^ ERROR implementation not supported in `trait` or `impl`
     default!();
     default::foo::bar!();
     default default!();
     default default::foo::bar!();
     default macro foo {}
-    //~^ ERROR item kind not supported in `trait` or `impl`
+    //~^ ERROR macro definition not supported in `trait` or `impl`
     default macro_rules! foo {}
-    //~^ ERROR item kind not supported in `trait` or `impl`
+    //~^ ERROR macro definition not supported in `trait` or `impl`
 }
 
 #[cfg(FALSE)]
 trait T {
     default extern crate foo;
-    //~^ ERROR item kind not supported in `trait` or `impl`
+    //~^ ERROR extern crate not supported in `trait` or `impl`
     default use foo;
-    //~^ ERROR item kind not supported in `trait` or `impl`
+    //~^ ERROR `use` import not supported in `trait` or `impl`
     default static foo: u8;
     //~^ ERROR associated `static` items are not allowed
     default const foo: u8;
     default fn foo();
     default mod foo {}
-    //~^ ERROR item kind not supported in `trait` or `impl`
+    //~^ ERROR module not supported in `trait` or `impl`
     default extern "C" {}
-    //~^ ERROR item kind not supported in `trait` or `impl`
+    //~^ ERROR extern block not supported in `trait` or `impl`
     default type foo = u8;
     default enum foo {}
-    //~^ ERROR item kind not supported in `trait` or `impl`
+    //~^ ERROR enum not supported in `trait` or `impl`
     default struct foo {}
-    //~^ ERROR item kind not supported in `trait` or `impl`
+    //~^ ERROR struct not supported in `trait` or `impl`
     default union foo {}
-    //~^ ERROR item kind not supported in `trait` or `impl`
+    //~^ ERROR union not supported in `trait` or `impl`
     default trait foo {}
-    //~^ ERROR item kind not supported in `trait` or `impl`
+    //~^ ERROR trait not supported in `trait` or `impl`
     default trait foo = Ord;
-    //~^ ERROR item kind not supported in `trait` or `impl`
+    //~^ ERROR trait alias not supported in `trait` or `impl`
     default impl foo {}
-    //~^ ERROR item kind not supported in `trait` or `impl`
+    //~^ ERROR implementation not supported in `trait` or `impl`
     default!();
     default::foo::bar!();
     default default!();
     default default::foo::bar!();
     default macro foo {}
-    //~^ ERROR item kind not supported in `trait` or `impl`
+    //~^ ERROR macro definition not supported in `trait` or `impl`
     default macro_rules! foo {}
-    //~^ ERROR item kind not supported in `trait` or `impl`
+    //~^ ERROR macro definition not supported in `trait` or `impl`
 }
diff --git a/src/test/ui/parser/default-on-wrong-item-kind.stderr b/src/test/ui/parser/default-on-wrong-item-kind.stderr
index 6c4c108a28f..ec569b43d70 100644
--- a/src/test/ui/parser/default-on-wrong-item-kind.stderr
+++ b/src/test/ui/parser/default-on-wrong-item-kind.stderr
@@ -142,7 +142,7 @@ LL |     default extern crate foo;
    |
    = note: only associated `fn`, `const`, and `type` items can be `default`
 
-error: item kind not supported in `extern` block
+error: extern crate not supported in `extern` block
   --> $DIR/default-on-wrong-item-kind.rs:33:5
    |
 LL |     default extern crate foo;
@@ -156,7 +156,7 @@ LL |     default use foo;
    |
    = note: only associated `fn`, `const`, and `type` items can be `default`
 
-error: item kind not supported in `extern` block
+error: `use` import not supported in `extern` block
   --> $DIR/default-on-wrong-item-kind.rs:35:5
    |
 LL |     default use foo;
@@ -204,7 +204,7 @@ LL |     default mod foo {}
    |
    = note: only associated `fn`, `const`, and `type` items can be `default`
 
-error: item kind not supported in `extern` block
+error: module not supported in `extern` block
   --> $DIR/default-on-wrong-item-kind.rs:41:5
    |
 LL |     default mod foo {}
@@ -218,7 +218,7 @@ LL |     default extern "C" {}
    |
    = note: only associated `fn`, `const`, and `type` items can be `default`
 
-error: item kind not supported in `extern` block
+error: extern block not supported in `extern` block
   --> $DIR/default-on-wrong-item-kind.rs:43:5
    |
 LL |     default extern "C" {}
@@ -240,7 +240,7 @@ LL |     default enum foo {}
    |
    = note: only associated `fn`, `const`, and `type` items can be `default`
 
-error: item kind not supported in `extern` block
+error: enum not supported in `extern` block
   --> $DIR/default-on-wrong-item-kind.rs:46:5
    |
 LL |     default enum foo {}
@@ -254,7 +254,7 @@ LL |     default struct foo {}
    |
    = note: only associated `fn`, `const`, and `type` items can be `default`
 
-error: item kind not supported in `extern` block
+error: struct not supported in `extern` block
   --> $DIR/default-on-wrong-item-kind.rs:48:5
    |
 LL |     default struct foo {}
@@ -268,7 +268,7 @@ LL |     default union foo {}
    |
    = note: only associated `fn`, `const`, and `type` items can be `default`
 
-error: item kind not supported in `extern` block
+error: union not supported in `extern` block
   --> $DIR/default-on-wrong-item-kind.rs:50:5
    |
 LL |     default union foo {}
@@ -282,7 +282,7 @@ LL |     default trait foo {}
    |
    = note: only associated `fn`, `const`, and `type` items can be `default`
 
-error: item kind not supported in `extern` block
+error: trait not supported in `extern` block
   --> $DIR/default-on-wrong-item-kind.rs:52:5
    |
 LL |     default trait foo {}
@@ -296,13 +296,13 @@ LL |     default trait foo = Ord;
    |
    = note: only associated `fn`, `const`, and `type` items can be `default`
 
-error: item kind not supported in `extern` block
+error: trait alias not supported in `extern` block
   --> $DIR/default-on-wrong-item-kind.rs:54:5
    |
 LL |     default trait foo = Ord;
    |     ^^^^^^^^^^^^^^^^^^^^^^^^
 
-error: item kind not supported in `extern` block
+error: implementation not supported in `extern` block
   --> $DIR/default-on-wrong-item-kind.rs:56:5
    |
 LL |     default impl foo {}
@@ -332,7 +332,7 @@ LL |     default macro foo {}
    |
    = note: only associated `fn`, `const`, and `type` items can be `default`
 
-error: item kind not supported in `extern` block
+error: macro definition not supported in `extern` block
   --> $DIR/default-on-wrong-item-kind.rs:62:5
    |
 LL |     default macro foo {}
@@ -346,19 +346,19 @@ LL |     default macro_rules! foo {}
    |
    = note: only associated `fn`, `const`, and `type` items can be `default`
 
-error: item kind not supported in `extern` block
+error: macro definition not supported in `extern` block
   --> $DIR/default-on-wrong-item-kind.rs:64:5
    |
 LL |     default macro_rules! foo {}
    |     ^^^^^^^^^^^^^^^^^^^^^^^^
 
-error: item kind not supported in `trait` or `impl`
+error: extern crate not supported in `trait` or `impl`
   --> $DIR/default-on-wrong-item-kind.rs:70:5
    |
 LL |     default extern crate foo;
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^
 
-error: item kind not supported in `trait` or `impl`
+error: `use` import not supported in `trait` or `impl`
   --> $DIR/default-on-wrong-item-kind.rs:72:5
    |
 LL |     default use foo;
@@ -370,73 +370,73 @@ error: associated `static` items are not allowed
 LL |     default static foo: u8;
    |     ^^^^^^^^^^^^^^^^^^^^^^^
 
-error: item kind not supported in `trait` or `impl`
+error: module not supported in `trait` or `impl`
   --> $DIR/default-on-wrong-item-kind.rs:78:5
    |
 LL |     default mod foo {}
    |     ^^^^^^^^^^^^^^^
 
-error: item kind not supported in `trait` or `impl`
+error: extern block not supported in `trait` or `impl`
   --> $DIR/default-on-wrong-item-kind.rs:80:5
    |
 LL |     default extern "C" {}
    |     ^^^^^^^^^^^^^^^^^^
 
-error: item kind not supported in `trait` or `impl`
+error: enum not supported in `trait` or `impl`
   --> $DIR/default-on-wrong-item-kind.rs:83:5
    |
 LL |     default enum foo {}
    |     ^^^^^^^^^^^^^^^^
 
-error: item kind not supported in `trait` or `impl`
+error: struct not supported in `trait` or `impl`
   --> $DIR/default-on-wrong-item-kind.rs:85:5
    |
 LL |     default struct foo {}
    |     ^^^^^^^^^^^^^^^^^^
 
-error: item kind not supported in `trait` or `impl`
+error: union not supported in `trait` or `impl`
   --> $DIR/default-on-wrong-item-kind.rs:87:5
    |
 LL |     default union foo {}
    |     ^^^^^^^^^^^^^^^^^
 
-error: item kind not supported in `trait` or `impl`
+error: trait not supported in `trait` or `impl`
   --> $DIR/default-on-wrong-item-kind.rs:89:5
    |
 LL |     default trait foo {}
    |     ^^^^^^^^^^^^^^^^^
 
-error: item kind not supported in `trait` or `impl`
+error: trait alias not supported in `trait` or `impl`
   --> $DIR/default-on-wrong-item-kind.rs:91:5
    |
 LL |     default trait foo = Ord;
    |     ^^^^^^^^^^^^^^^^^^^^^^^^
 
-error: item kind not supported in `trait` or `impl`
+error: implementation not supported in `trait` or `impl`
   --> $DIR/default-on-wrong-item-kind.rs:93:5
    |
 LL |     default impl foo {}
    |     ^^^^^^^^^^^^^^^^
 
-error: item kind not supported in `trait` or `impl`
+error: macro definition not supported in `trait` or `impl`
   --> $DIR/default-on-wrong-item-kind.rs:99:5
    |
 LL |     default macro foo {}
    |     ^^^^^^^^^^^^^^^^^
 
-error: item kind not supported in `trait` or `impl`
+error: macro definition not supported in `trait` or `impl`
   --> $DIR/default-on-wrong-item-kind.rs:101:5
    |
 LL |     default macro_rules! foo {}
    |     ^^^^^^^^^^^^^^^^^^^^^^^^
 
-error: item kind not supported in `trait` or `impl`
+error: extern crate not supported in `trait` or `impl`
   --> $DIR/default-on-wrong-item-kind.rs:107:5
    |
 LL |     default extern crate foo;
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^
 
-error: item kind not supported in `trait` or `impl`
+error: `use` import not supported in `trait` or `impl`
   --> $DIR/default-on-wrong-item-kind.rs:109:5
    |
 LL |     default use foo;
@@ -448,61 +448,61 @@ error: associated `static` items are not allowed
 LL |     default static foo: u8;
    |     ^^^^^^^^^^^^^^^^^^^^^^^
 
-error: item kind not supported in `trait` or `impl`
+error: module not supported in `trait` or `impl`
   --> $DIR/default-on-wrong-item-kind.rs:115:5
    |
 LL |     default mod foo {}
    |     ^^^^^^^^^^^^^^^
 
-error: item kind not supported in `trait` or `impl`
+error: extern block not supported in `trait` or `impl`
   --> $DIR/default-on-wrong-item-kind.rs:117:5
    |
 LL |     default extern "C" {}
    |     ^^^^^^^^^^^^^^^^^^
 
-error: item kind not supported in `trait` or `impl`
+error: enum not supported in `trait` or `impl`
   --> $DIR/default-on-wrong-item-kind.rs:120:5
    |
 LL |     default enum foo {}
    |     ^^^^^^^^^^^^^^^^
 
-error: item kind not supported in `trait` or `impl`
+error: struct not supported in `trait` or `impl`
   --> $DIR/default-on-wrong-item-kind.rs:122:5
    |
 LL |     default struct foo {}
    |     ^^^^^^^^^^^^^^^^^^
 
-error: item kind not supported in `trait` or `impl`
+error: union not supported in `trait` or `impl`
   --> $DIR/default-on-wrong-item-kind.rs:124:5
    |
 LL |     default union foo {}
    |     ^^^^^^^^^^^^^^^^^
 
-error: item kind not supported in `trait` or `impl`
+error: trait not supported in `trait` or `impl`
   --> $DIR/default-on-wrong-item-kind.rs:126:5
    |
 LL |     default trait foo {}
    |     ^^^^^^^^^^^^^^^^^
 
-error: item kind not supported in `trait` or `impl`
+error: trait alias not supported in `trait` or `impl`
   --> $DIR/default-on-wrong-item-kind.rs:128:5
    |
 LL |     default trait foo = Ord;
    |     ^^^^^^^^^^^^^^^^^^^^^^^^
 
-error: item kind not supported in `trait` or `impl`
+error: implementation not supported in `trait` or `impl`
   --> $DIR/default-on-wrong-item-kind.rs:130:5
    |
 LL |     default impl foo {}
    |     ^^^^^^^^^^^^^^^^
 
-error: item kind not supported in `trait` or `impl`
+error: macro definition not supported in `trait` or `impl`
   --> $DIR/default-on-wrong-item-kind.rs:136:5
    |
 LL |     default macro foo {}
    |     ^^^^^^^^^^^^^^^^^
 
-error: item kind not supported in `trait` or `impl`
+error: macro definition not supported in `trait` or `impl`
   --> $DIR/default-on-wrong-item-kind.rs:138:5
    |
 LL |     default macro_rules! foo {}
diff --git a/src/test/ui/parser/mismatched-braces/missing-close-brace-in-impl-trait.rs b/src/test/ui/parser/mismatched-braces/missing-close-brace-in-impl-trait.rs
index d85255328f7..b26e5134db6 100644
--- a/src/test/ui/parser/mismatched-braces/missing-close-brace-in-impl-trait.rs
+++ b/src/test/ui/parser/mismatched-braces/missing-close-brace-in-impl-trait.rs
@@ -4,10 +4,10 @@ impl T for () { //~ ERROR cannot find trait `T` in this scope
 
 fn foo(&self) {}
 
-trait T { //~ ERROR item kind not supported in `trait` or `impl`
+trait T { //~ ERROR trait not supported in `trait` or `impl`
     fn foo(&self);
 }
 
-pub(crate) struct Bar<T>(); //~ ERROR item kind not supported in `trait` or `impl`
+pub(crate) struct Bar<T>(); //~ ERROR struct not supported in `trait` or `impl`
 
 //~ ERROR this file contains an unclosed delimiter
diff --git a/src/test/ui/parser/mismatched-braces/missing-close-brace-in-impl-trait.stderr b/src/test/ui/parser/mismatched-braces/missing-close-brace-in-impl-trait.stderr
index 2b72c06c9c7..b1bd1a784be 100644
--- a/src/test/ui/parser/mismatched-braces/missing-close-brace-in-impl-trait.stderr
+++ b/src/test/ui/parser/mismatched-braces/missing-close-brace-in-impl-trait.stderr
@@ -7,13 +7,13 @@ LL | impl T for () {
 LL |
    |                                                    ^
 
-error: item kind not supported in `trait` or `impl`
+error: trait not supported in `trait` or `impl`
   --> $DIR/missing-close-brace-in-impl-trait.rs:7:1
    |
 LL | trait T {
    | ^^^^^^^
 
-error: item kind not supported in `trait` or `impl`
+error: struct not supported in `trait` or `impl`
   --> $DIR/missing-close-brace-in-impl-trait.rs:11:1
    |
 LL | pub(crate) struct Bar<T>();
diff --git a/src/test/ui/parser/mismatched-braces/missing-close-brace-in-trait.rs b/src/test/ui/parser/mismatched-braces/missing-close-brace-in-trait.rs
index b2515b17ff3..d52add27398 100644
--- a/src/test/ui/parser/mismatched-braces/missing-close-brace-in-trait.rs
+++ b/src/test/ui/parser/mismatched-braces/missing-close-brace-in-trait.rs
@@ -2,10 +2,10 @@ trait T {
     fn foo(&self);
 
 pub(crate) struct Bar<T>();
-//~^ ERROR item kind not supported in `trait` or `impl`
+//~^ ERROR struct not supported in `trait` or `impl`
 
 impl T for Bar<usize> {
-//~^ ERROR item kind not supported in `trait` or `impl`
+//~^ ERROR implementation not supported in `trait` or `impl`
 fn foo(&self) {}
 }
 
diff --git a/src/test/ui/parser/mismatched-braces/missing-close-brace-in-trait.stderr b/src/test/ui/parser/mismatched-braces/missing-close-brace-in-trait.stderr
index 89bf2916510..49c685f2549 100644
--- a/src/test/ui/parser/mismatched-braces/missing-close-brace-in-trait.stderr
+++ b/src/test/ui/parser/mismatched-braces/missing-close-brace-in-trait.stderr
@@ -7,13 +7,13 @@ LL | trait T {
 LL | fn main() {}
    |                                                                 ^
 
-error: item kind not supported in `trait` or `impl`
+error: struct not supported in `trait` or `impl`
   --> $DIR/missing-close-brace-in-trait.rs:4:1
    |
 LL | pub(crate) struct Bar<T>();
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
-error: item kind not supported in `trait` or `impl`
+error: implementation not supported in `trait` or `impl`
   --> $DIR/missing-close-brace-in-trait.rs:7:1
    |
 LL | impl T for Bar<usize> {