1
Fork 0

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.
This commit is contained in:
bors 2014-10-17 20:32:22 +00:00
commit 4694b99102
10 changed files with 52 additions and 22 deletions

View file

@ -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)
}