diff options
| author | Mazdak Farrokhzad <twingoow@gmail.com> | 2020-02-23 04:49:26 +0100 |
|---|---|---|
| committer | Mazdak Farrokhzad <twingoow@gmail.com> | 2020-02-24 00:59:38 +0100 |
| commit | ab84914fe47aa2da615c9e759e686d1a45f8aae3 (patch) | |
| tree | 408412e26a58c1b2da1da200a4202b6f19e7e25d /src/librustc_parse | |
| parent | d446c73e6ab94fe37f7d7b8f2abf633ed6344c8a (diff) | |
| download | rust-ab84914fe47aa2da615c9e759e686d1a45f8aae3.tar.gz rust-ab84914fe47aa2da615c9e759e686d1a45f8aae3.zip | |
parser: tweak unmatched wording
Diffstat (limited to 'src/librustc_parse')
| -rw-r--r-- | src/librustc_parse/parser/item.rs | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/librustc_parse/parser/item.rs b/src/librustc_parse/parser/item.rs index 52619866c4e..d2073a5473a 100644 --- a/src/librustc_parse/parser/item.rs +++ b/src/librustc_parse/parser/item.rs @@ -119,17 +119,18 @@ impl<'a> Parser<'a> { } let vs = pprust::vis_to_string(&vis); let vs = vs.trim_end(); - self.struct_span_err(vis.span, &format!("unmatched visibility `{}`", vs)) - .span_label(vis.span, "the unmatched visibility") + self.struct_span_err(vis.span, &format!("visibility `{}` 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(); } /// Error in-case a `default` was parsed but no item followed. fn error_on_unmatched_defaultness(&self, def: Defaultness) { - if let Defaultness::Default(span) = def { - self.struct_span_err(span, "unmatched `default`") - .span_label(span, "the unmatched `default`") + if let Defaultness::Default(sp) = def { + self.struct_span_err(sp, "`default` 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(); } } |
