Skip to content

Commit e3516a1

Browse files
committed
librustc_errors: Add some more documentation
1 parent 5d4aef6 commit e3516a1

File tree

4 files changed

+20
-3
lines changed

4 files changed

+20
-3
lines changed

src/librustc/session/config.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -227,13 +227,17 @@ impl OutputType {
227227
}
228228
}
229229

230+
/// The type of diagnostics output to generate
230231
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
231232
pub enum ErrorOutputType {
233+
/// Output meant for the consumption of humans.
232234
HumanReadable(HumanReadableErrorType),
235+
/// Output that's consumed by other tools such as `rustfix` or the `RLS`.
233236
Json {
234-
/// Render the json in a human readable way (with indents and newlines)
237+
/// Render the JSON in a human readable way (with indents and newlines)
235238
pretty: bool,
236-
/// The way the `rendered` field is created
239+
/// The JSON output includes a `rendered` field that includes the rendered
240+
/// human output.
237241
json_rendered: HumanReadableErrorType,
238242
},
239243
}

src/librustc_errors/diagnostic_builder.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ impl<'a> DiagnosticBuilder<'a> {
348348

349349
/// Convenience function for internal use, clients should use one of the
350350
/// struct_* methods on Handler.
351-
pub fn new_with_code(handler: &'a Handler,
351+
pub(crate) fn new_with_code(handler: &'a Handler,
352352
level: Level,
353353
code: Option<DiagnosticId>,
354354
message: &str)

src/librustc_errors/emitter.rs

+9
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
//! The current rustc diagnostics emitter.
2+
//!
3+
//! An `Emitter` takes care of generating the output from a `DiagnosticBuilder` struct.
4+
//!
5+
//! There are various `Emitter` implementations that generate different output formats such as
6+
//! JSON and human readable output.
7+
//!
8+
//! The output types are defined in `librustc::session::config::ErrorOutputType`.
9+
110
use Destination::*;
211

312
use syntax_pos::{SourceFile, Span, MultiSpan};

src/librustc_errors/lib.rs

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
//! Diagnostics creation and emission for rustc
2+
//!
3+
//! This module contains the code for creating and emitting diagnostics.
4+
15
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/")]
26

37
#![allow(unused_attributes)]

0 commit comments

Comments
 (0)