about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMazdak Farrokhzad <twingoow@gmail.com>2019-06-11 17:14:03 +0200
committerGitHub <noreply@github.com>2019-06-11 17:14:03 +0200
commitb3169552e2bf6ba8f9d3a8898acdcbd8f6aa3ac6 (patch)
tree1c8ccf25ff005d8196910cd58ea152b9352bb72d
parent79ac25470320717db398516ecdeda0a423371a00 (diff)
parent33137ffdd5ffd7b80b01dafa88f2f4f301ef6b25 (diff)
Rollup merge of #61686 - phansch:librustc_errors_docs, r=estebank
librustc_errors: Add some more documentation

r? @estebank
-rw-r--r--src/librustc/session/config.rs8
-rw-r--r--src/librustc_errors/diagnostic_builder.rs2
-rw-r--r--src/librustc_errors/emitter.rs9
-rw-r--r--src/librustc_errors/lib.rs5
4 files changed, 21 insertions, 3 deletions
diff --git a/src/librustc/session/config.rs b/src/librustc/session/config.rs
index 003fdd501a3..86a606b5fd3 100644
--- a/src/librustc/session/config.rs
+++ b/src/librustc/session/config.rs
@@ -227,13 +227,17 @@ impl OutputType {
     }
 }
 
+/// The type of diagnostics output to generate.
 #[derive(Clone, Copy, Debug, PartialEq, Eq)]
 pub enum ErrorOutputType {
+    /// Output meant for the consumption of humans.
     HumanReadable(HumanReadableErrorType),
+    /// Output that's consumed by other tools such as `rustfix` or the `RLS`.
     Json {
-        /// Render the json in a human readable way (with indents and newlines)
+        /// Render the JSON in a human readable way (with indents and newlines).
         pretty: bool,
-        /// The way the `rendered` field is created
+        /// The JSON output includes a `rendered` field that includes the rendered
+        /// human output.
         json_rendered: HumanReadableErrorType,
     },
 }
diff --git a/src/librustc_errors/diagnostic_builder.rs b/src/librustc_errors/diagnostic_builder.rs
index 31f697a724a..fc74e43ff57 100644
--- a/src/librustc_errors/diagnostic_builder.rs
+++ b/src/librustc_errors/diagnostic_builder.rs
@@ -348,7 +348,7 @@ impl<'a> DiagnosticBuilder<'a> {
 
     /// Convenience function for internal use, clients should use one of the
     /// struct_* methods on Handler.
-    pub fn new_with_code(handler: &'a Handler,
+    crate fn new_with_code(handler: &'a Handler,
                          level: Level,
                          code: Option<DiagnosticId>,
                          message: &str)
diff --git a/src/librustc_errors/emitter.rs b/src/librustc_errors/emitter.rs
index 3bf477efe35..fca8298409a 100644
--- a/src/librustc_errors/emitter.rs
+++ b/src/librustc_errors/emitter.rs
@@ -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};
diff --git a/src/librustc_errors/lib.rs b/src/librustc_errors/lib.rs
index cc3180c783b..6ec1b90cd91 100644
--- a/src/librustc_errors/lib.rs
+++ b/src/librustc_errors/lib.rs
@@ -1,5 +1,10 @@
+//! Diagnostics creation and emission for `rustc`.
+//!
+//! This module contains the code for creating and emitting diagnostics.
+
 #![doc(html_root_url = "https://doc.rust-lang.org/nightly/")]
 
+#![feature(crate_visibility_modifier)]
 #![allow(unused_attributes)]
 #![cfg_attr(unix, feature(libc))]
 #![feature(nll)]