about summary refs log tree commit diff
path: root/src/libsyntax/parse
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2014-10-17 20:32:22 +0000
committerbors <bors@rust-lang.org>2014-10-17 20:32:22 +0000
commit4694b9910279f5af7dd9c4616b5870c82aead7f0 (patch)
treed437e6d99b8d5bc3910dc8026581604ff6f3cdf2 /src/libsyntax/parse
parent97bf93e405218dbc5e5506fa38572e562a796ac4 (diff)
parent06d9cc1d7a8582ff844c21a3fafe09dc97f22895 (diff)
auto merge of #16855 : P1start/rust/help-messages, r=brson
This adds ‘help’ diagnostic messages to rustc. This is used for anything that provides help to the user, particularly the `--explain` messages that were previously integrated into the relevant error message.

They look like this:

```
match.rs:10:13: 10:14 error: unreachable pattern [E0001]
match.rs:10             1 => {},
                        ^
match.rs:3:1: 3:38 note: in expansion of foo!
match.rs:7:5: 20:2 note: expansion site
match.rs:10:13: 10:14 help: pass `--explain E0001` to see a detailed explanation
```

(`help` is coloured cyan.) Adding these errors on a separate line stops the lines from being too long, as discussed in #16619.
Diffstat (limited to 'src/libsyntax/parse')
-rw-r--r--src/libsyntax/parse/parser.rs3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index 7e77283cca7..17f52bc21c5 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -959,6 +959,9 @@ impl<'a> Parser<'a> {
     pub fn span_note(&mut self, sp: Span, m: &str) {
         self.sess.span_diagnostic.span_note(sp, m)
     }
+    pub fn span_help(&mut self, sp: Span, m: &str) {
+        self.sess.span_diagnostic.span_help(sp, m)
+    }
     pub fn bug(&mut self, m: &str) -> ! {
         self.sess.span_diagnostic.span_bug(self.span, m)
     }