]> git.lizzy.rs Git - rust.git/commitdiff
Rollup merge of #61686 - phansch:librustc_errors_docs, r=estebank
authorMazdak Farrokhzad <twingoow@gmail.com>
Tue, 11 Jun 2019 15:14:03 +0000 (17:14 +0200)
committerGitHub <noreply@github.com>
Tue, 11 Jun 2019 15:14:03 +0000 (17:14 +0200)
librustc_errors: Add some more documentation

r? @estebank

src/librustc/session/config.rs
src/librustc_errors/diagnostic_builder.rs
src/librustc_errors/emitter.rs
src/librustc_errors/lib.rs

index 003fdd501a35ab55e5fc04b54f1717b363e3cb46..86a606b5fd3d6d60e014f9614edfb4e108dbda11 100644 (file)
@@ -227,13 +227,17 @@ pub fn extension(&self) -> &'static str {
     }
 }
 
+/// 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,
     },
 }
index 31f697a724a0357385bfb81487c7684c32f84041..fc74e43ff5739e770ec056b8edd45a84acdd18ae 100644 (file)
@@ -348,7 +348,7 @@ pub fn new(handler: &'a Handler, level: Level, message: &str) -> DiagnosticBuild
 
     /// 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)
index 3bf477efe35f91f05eb08e4bedb02ba8cb596ed9..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};
index cc3180c783bdf9c22296cbed3b7181fc36c076a0..6ec1b90cd91cd72f38ab87d2158cbe41bbef0204 100644 (file)
@@ -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)]