diff options
| author | Mazdak Farrokhzad <twingoow@gmail.com> | 2020-03-26 14:13:50 +0100 |
|---|---|---|
| committer | Mazdak Farrokhzad <twingoow@gmail.com> | 2020-03-26 14:13:50 +0100 |
| commit | 91c68c5faed0cf6f61274678d8e1cf8d43f0d4f6 (patch) | |
| tree | be8884aba6ce0670f16ee61155b81a035f5307d5 /src/librustc_parse/parser | |
| parent | 3b1d7351186a073c72e4be3c7d7b7ab8f1f10c58 (diff) | |
| download | rust-91c68c5faed0cf6f61274678d8e1cf8d43f0d4f6.tar.gz rust-91c68c5faed0cf6f61274678d8e1cf8d43f0d4f6.zip | |
error_bad_item_kind: add help text
Diffstat (limited to 'src/librustc_parse/parser')
| -rw-r--r-- | src/librustc_parse/parser/item.rs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/librustc_parse/parser/item.rs b/src/librustc_parse/parser/item.rs index cc88464d774..6b7a9ec658d 100644 --- a/src/librustc_parse/parser/item.rs +++ b/src/librustc_parse/parser/item.rs @@ -908,8 +908,10 @@ 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().guess_head_span(span); - let msg = format!("{} is not supported in {}", kind.descr(), ctx); - self.struct_span_err(span, &msg).emit(); + let descr = kind.descr(); + self.struct_span_err(span, &format!("{} is not supported in {}", descr, ctx)) + .help(&format!("consider moving the {} out to a nearby module scope", descr)) + .emit(); None } |
