]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc_errors/emitter.rs
Rollup merge of #61686 - phansch:librustc_errors_docs, r=estebank
[rust.git] / src / librustc_errors / emitter.rs
index e1112a1557771c7e4b7f6fa4c34ba452801ec52f..fca8298409a61f5add93a7a787e6c4f6ba04cda2 100644 (file)
@@ -1,3 +1,12 @@
+//! The current rustc diagnostics emitter.
+//!
+//! An `Emitter` takes care of generating the output from a `DiagnosticBuilder` struct.
+//!
+//! There are various `Emitter` implementations that generate different output formats such as
+//! JSON and human readable output.
+//!
+//! The output types are defined in `librustc::session::config::ErrorOutputType`.
+
 use Destination::*;
 
 use syntax_pos::{SourceFile, Span, MultiSpan};
@@ -24,6 +33,7 @@
 #[derive(Clone, Copy, Debug, PartialEq, Eq)]
 pub enum HumanReadableErrorType {
     Default(ColorConfig),
+    AnnotateSnippet(ColorConfig),
     Short(ColorConfig),
 }
 
@@ -33,6 +43,7 @@ pub fn unzip(self) -> (bool, ColorConfig) {
         match self {
             HumanReadableErrorType::Default(cc) => (false, cc),
             HumanReadableErrorType::Short(cc) => (true, cc),
+            HumanReadableErrorType::AnnotateSnippet(cc) => (false, cc),
         }
     }
     pub fn new_emitter(
@@ -173,8 +184,8 @@ pub struct EmitterWriter {
 
 #[derive(Debug)]
 pub struct FileWithAnnotatedLines {
-    file: Lrc<SourceFile>,
-    lines: Vec<Line>,
+    pub file: Lrc<SourceFile>,
+    pub lines: Vec<Line>,
     multiline_depth: usize,
 }