diff options
| author | Mazdak Farrokhzad <twingoow@gmail.com> | 2020-02-23 12:54:00 +0100 |
|---|---|---|
| committer | Mazdak Farrokhzad <twingoow@gmail.com> | 2020-02-24 00:59:38 +0100 |
| commit | fde5939d1c843c3ede7f6ea0eef704f52854b45d (patch) | |
| tree | 46e6b7a6a3f1548af4da6432e08fc3f317f020fc /src/librustc_parse/parser/item.rs | |
| parent | e66a39bb65eb4a7fb1813993e10fc1af5bdac9bc (diff) | |
| download | rust-fde5939d1c843c3ede7f6ea0eef704f52854b45d.tar.gz rust-fde5939d1c843c3ede7f6ea0eef704f52854b45d.zip | |
parse: tweak diagnostic wordings
Diffstat (limited to 'src/librustc_parse/parser/item.rs')
| -rw-r--r-- | src/librustc_parse/parser/item.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/librustc_parse/parser/item.rs b/src/librustc_parse/parser/item.rs index c85b4c22d01..d6da6270541 100644 --- a/src/librustc_parse/parser/item.rs +++ b/src/librustc_parse/parser/item.rs @@ -112,7 +112,7 @@ impl<'a> Parser<'a> { } let vs = pprust::vis_to_string(&vis); let vs = vs.trim_end(); - self.struct_span_err(vis.span, &format!("visibility `{}` not followed by an item", vs)) + self.struct_span_err(vis.span, &format!("visibility `{}` is not followed by an item", vs)) .span_label(vis.span, "the visibility") .help(&format!("you likely meant to define an item, e.g., `{} fn foo() {{}}`", vs)) .emit(); @@ -121,7 +121,7 @@ impl<'a> Parser<'a> { /// Error in-case a `default` was parsed but no item followed. fn error_on_unmatched_defaultness(&self, def: Defaultness) { if let Defaultness::Default(sp) = def { - self.struct_span_err(sp, "`default` not followed by an item") + self.struct_span_err(sp, "`default` is not followed by an item") .span_label(sp, "the `default` qualifier") .note("only `fn`, `const`, `type`, or `impl` items may be prefixed by `default`") .emit(); @@ -657,7 +657,7 @@ impl<'a> Parser<'a> { self.struct_span_err(span, "associated `static` items are not allowed").emit(); AssocItemKind::Const(Defaultness::Final, a, b) } - _ => return self.error_bad_item_kind(span, &kind, "`trait` or `impl`"), + _ => return self.error_bad_item_kind(span, &kind, "`trait`s or `impl`s"), }; Some(P(Item { attrs, id, span, vis, ident, kind, tokens })) })) @@ -846,7 +846,7 @@ impl<'a> Parser<'a> { self.error_on_foreign_const(span, ident); ForeignItemKind::Static(a, Mutability::Not, b) } - _ => return self.error_bad_item_kind(span, &kind, "`extern` block"), + _ => return self.error_bad_item_kind(span, &kind, "`extern` blocks"), }; Some(P(Item { attrs, id, span, vis, ident, kind, tokens })) })) @@ -854,7 +854,7 @@ impl<'a> Parser<'a> { 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); + let msg = format!("{} is not supported in {}", kind.descr(), ctx); self.struct_span_err(span, &msg).emit(); return None; } |
