Rollup merge of #30787 - nikomatsakis:future-incompatible-lint, r=brson

There is now more structure to the report, so that you can specify e.g. an RFC/PR/issue number and other explanatory details.

Example message:

```
type-parameter-invalid-lint.rs:14:8: 14:9 error: defaults for type parameters are only allowed on type definitions, like `struct` or `enum`
type-parameter-invalid-lint.rs:14 fn avg<T=i32>(_: T) {}
                                         ^
type-parameter-invalid-lint.rs:14:8: 14:9 warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
type-parameter-invalid-lint.rs:14:8: 14:9 note: for more information, see PR 30742 <https://github.com/rust-lang/rust/pull/30724>
type-parameter-invalid-lint.rs:11:9: 11:28 note: lint level defined here
type-parameter-invalid-lint.rs:11 #![deny(future_incompatible)]
                                          ^~~~~~~~~~~~~~~~~~~
error: aborting due to previous error
```

r? @brson

I would really like feedback also on the specific messages!

Fixes #30746
This commit is contained in:
Manish Goregaokar
2016-01-15 17:28:28 +05:30
12 changed files with 127 additions and 22 deletions

View File

@@ -161,6 +161,17 @@ impl<'a> DiagnosticBuilder<'a> {
self.sub(Level::Note, msg, Some(sp), None);
self
}
pub fn warn(&mut self, msg: &str) -> &mut DiagnosticBuilder<'a> {
self.sub(Level::Warning, msg, None, None);
self
}
pub fn span_warn(&mut self,
sp: Span,
msg: &str)
-> &mut DiagnosticBuilder<'a> {
self.sub(Level::Warning, msg, Some(sp), None);
self
}
pub fn help(&mut self , msg: &str) -> &mut DiagnosticBuilder<'a> {
self.sub(Level::Help, msg, None, None);
self
@@ -190,6 +201,13 @@ impl<'a> DiagnosticBuilder<'a> {
self.sub(Level::Note, msg, Some(sp), Some(EndSpan(sp)));
self
}
pub fn fileline_warn(&mut self ,
sp: Span,
msg: &str)
-> &mut DiagnosticBuilder<'a> {
self.sub(Level::Warning, msg, Some(sp), Some(FileLine(sp)));
self
}
pub fn fileline_note(&mut self ,
sp: Span,
msg: &str)