diff options
| author | Nick Cameron <ncameron@mozilla.com> | 2015-12-24 10:54:37 +1300 |
|---|---|---|
| committer | Nick Cameron <ncameron@mozilla.com> | 2015-12-30 14:54:36 +1300 |
| commit | 04d972906d05e6c27452e1ae35970c30e7cf6e6b (patch) | |
| tree | 0261ceb0e0bd8f61282f57e1c142438c99c43f60 /src/libsyntax/errors | |
| parent | aaa02b3ff9401eeece5cd47f51a6b4c27ad63d93 (diff) | |
| download | rust-04d972906d05e6c27452e1ae35970c30e7cf6e6b.tar.gz rust-04d972906d05e6c27452e1ae35970c30e7cf6e6b.zip | |
Rebasing and review comments
Diffstat (limited to 'src/libsyntax/errors')
| -rw-r--r-- | src/libsyntax/errors/emitter.rs | 6 | ||||
| -rw-r--r-- | src/libsyntax/errors/mod.rs | 34 |
2 files changed, 17 insertions, 23 deletions
diff --git a/src/libsyntax/errors/emitter.rs b/src/libsyntax/errors/emitter.rs index 8b9df7aa921..a7bfdedf718 100644 --- a/src/libsyntax/errors/emitter.rs +++ b/src/libsyntax/errors/emitter.rs @@ -28,7 +28,7 @@ pub trait Emitter { fn emit(&mut self, span: Option<Span>, msg: &str, code: Option<&str>, lvl: Level); fn custom_emit(&mut self, sp: RenderSpan, msg: &str, lvl: Level); - // Emit a structured diagnostic. + /// Emit a structured diagnostic. fn emit_struct(&mut self, db: &DiagnosticBuilder) { self.emit(db.span, &db.message, db.code.as_ref().map(|s| &**s), db.level); for child in &db.children { @@ -60,8 +60,8 @@ impl ColorConfig { } } -// A basic emitter for when we don't have access to a codemap or registry. Used -// for reporting very early errors, etc. +/// A basic emitter for when we don't have access to a codemap or registry. Used +/// for reporting very early errors, etc. pub struct BasicEmitter { dst: Destination, } diff --git a/src/libsyntax/errors/mod.rs b/src/libsyntax/errors/mod.rs index 3cee14538a9..a2fae975148 100644 --- a/src/libsyntax/errors/mod.rs +++ b/src/libsyntax/errors/mod.rs @@ -98,7 +98,7 @@ impl error::Error for ExplicitBug { } } -// Used for emitting structured error messages and other diagnostic information. +/// Used for emitting structured error messages and other diagnostic information. #[must_use] pub struct DiagnosticBuilder<'a> { emitter: &'a RefCell<Box<Emitter>>, @@ -109,7 +109,7 @@ pub struct DiagnosticBuilder<'a> { children: Vec<SubDiagnostic>, } -// For example a note attached to an error. +/// For example a note attached to an error. struct SubDiagnostic { level: Level, message: String, @@ -118,7 +118,7 @@ struct SubDiagnostic { } impl<'a> DiagnosticBuilder<'a> { - // Emit the diagnostic. + /// Emit the diagnostic. pub fn emit(&mut self) { if self.cancelled() { return; @@ -132,11 +132,11 @@ impl<'a> DiagnosticBuilder<'a> { // } } - // Cancel the diagnostic (a structured diagnostic must either be emitted or - // cancelled or it will panic when dropped). - // BEWARE: if this DiagnosticBuilder is an error, then creating it will - // bump the error count on the Handler and cancelling it won't undo that. - // If you want to decrement the error count you should use `Handler::cancel`. + /// Cancel the diagnostic (a structured diagnostic must either be emitted or + /// cancelled or it will panic when dropped). + /// BEWARE: if this DiagnosticBuilder is an error, then creating it will + /// bump the error count on the Handler and cancelling it won't undo that. + /// If you want to decrement the error count you should use `Handler::cancel`. pub fn cancel(&mut self) { self.level = Level::Cancelled; } @@ -160,12 +160,6 @@ impl<'a> DiagnosticBuilder<'a> { self.sub(Level::Note, msg, Some(sp), None); self } - pub fn note_rfc_1214(&mut self , span: Span) -> &mut DiagnosticBuilder<'a> { - self.span_note(span, - "this warning results from recent bug fixes and clarifications; \ - it will become a HARD ERROR in the next release. \ - See RFC 1214 for details.") - } pub fn help(&mut self , msg: &str) -> &mut DiagnosticBuilder<'a> { self.sub(Level::Help, msg, None, None); self @@ -220,8 +214,8 @@ impl<'a> DiagnosticBuilder<'a> { self } - // Convenience function for internal use, clients should use one of the - // struct_* methods on Handler. + /// Convenience function for internal use, clients should use one of the + /// struct_* methods on Handler. fn new(emitter: &'a RefCell<Box<Emitter>>, level: Level, message: &str) -> DiagnosticBuilder<'a> { @@ -235,8 +229,8 @@ impl<'a> DiagnosticBuilder<'a> { } } - // Convenience function for internal use, clients should use one of the - // public methods above. + /// Convenience function for internal use, clients should use one of the + /// public methods above. fn sub(&mut self, level: Level, message: &str, @@ -258,8 +252,8 @@ impl<'a> fmt::Debug for DiagnosticBuilder<'a> { } } -// Destructor bomb - a DiagnosticBuilder must be either emitted or cancelled or -// we emit a bug. +/// Destructor bomb - a DiagnosticBuilder must be either emitted or cancelled or +/// we emit a bug. impl<'a> Drop for DiagnosticBuilder<'a> { fn drop(&mut self) { if !self.cancelled() { |
