Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

librustc_errors: Add some more documentation #61686

Merged
merged 2 commits into from
Jun 12, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/librustc/session/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
}
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_errors/diagnostic_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
9 changes: 9 additions & 0 deletions src/librustc_errors/emitter.rs
Original file line number Diff line number Diff line change
@@ -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};
Expand Down
5 changes: 5 additions & 0 deletions src/librustc_errors/lib.rs
Original file line number Diff line number Diff line change
@@ -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)]
Expand Down