Skip to main content

Module emitter

Module emitter 

Source
Expand description

The current rustc diagnostics emitter.

An Emitter takes care of generating the output from a Diag struct.

There are various Emitter implementations that generate different output formats such as JSON and human readable output.

The output types are defined in rustc_session::config::ErrorOutputType.

Re-exportsยง

use std::borrow::Cow; ๐Ÿ”’
use std::io; ๐Ÿ”’
use std::io::IsTerminal; ๐Ÿ”’
use std::iter; ๐Ÿ”’
use std::path::Path; ๐Ÿ”’
use anstream::AutoStream; ๐Ÿ”’
use anstream::ColorChoice; ๐Ÿ”’
use anstyle::AnsiColor; ๐Ÿ”’
use anstyle::Effects; ๐Ÿ”’
use rustc_data_structures::fx::FxIndexSet; ๐Ÿ”’
use rustc_data_structures::sync::DynSend; ๐Ÿ”’
use rustc_error_messages::DiagArgMap; ๐Ÿ”’
use rustc_span::hygiene::ExpnKind; ๐Ÿ”’
use rustc_span::hygiene::MacroKind; ๐Ÿ”’
use rustc_span::source_map::SourceMap; ๐Ÿ”’
use rustc_span::FileName; ๐Ÿ”’
use rustc_span::SourceFile; ๐Ÿ”’
use rustc_span::Span; ๐Ÿ”’
use tracing::debug; ๐Ÿ”’
use tracing::warn; ๐Ÿ”’
use crate::formatting::format_diag_message; ๐Ÿ”’
use crate::timings::TimingRecord; ๐Ÿ”’
use crate::CodeSuggestion; ๐Ÿ”’
use crate::DiagInner; ๐Ÿ”’
use crate::DiagMessage; ๐Ÿ”’
use crate::Level; ๐Ÿ”’
use crate::MultiSpan; ๐Ÿ”’
use crate::Style; ๐Ÿ”’
use crate::Subdiag; ๐Ÿ”’
use crate::Sublevel; ๐Ÿ”’
use crate::SuggestionStyle; ๐Ÿ”’
use std::io::prelude::*; ๐Ÿ”’

Structsยง

Buffy ๐Ÿ”’
EmitterWithNote
An emitter that adds a note to each diagnostic.
HumanReadableErrorType
Describes the way the content of the rendered field of the json output is generated
SilentEmitter

Enumsยง

ColorConfig
ConfusionType
Represents the type of confusion detected between original and suggested code.
OutputTheme
TimingEvent

Constantsยง

MAX_SUGGESTIONS
Maximum number of suggestions to be shown
OUTPUT_REPLACEMENTS ๐Ÿ”’

Traitsยง

Emitter
Emitter trait for emitting errors and other structured information.

Functionsยง

detect_confusion_type
Whether the original and suggested code are visually similar enough to warrant extra wording.
get_stderr_color_choice
is_different
Whether the original and suggested code are the same.
normalize_whitespace ๐Ÿ”’
should_show_source_code ๐Ÿ”’
stderr_destination

Type Aliasesยง

Destination
DynEmitter