Struct swc_common::errors::Handler [−][src]
pub struct Handler {
pub flags: HandlerFlags,
// some fields omitted
}
Expand description
A handler deals with errors; certain errors (fatal, bug, unimpl) may cause immediate exit, others log errors for later reporting.
Fields
flags: HandlerFlags
Implementations
pub fn with_tty_emitter(
color_config: ColorConfig,
can_emit_warnings: bool,
treat_err_as_bug: bool,
cm: Option<Lrc<SourceMapperDyn>>
) -> Handler
tty-emitter
only.pub fn with_tty_emitter_and_flags(
color_config: ColorConfig,
cm: Option<Lrc<SourceMapperDyn>>,
flags: HandlerFlags
) -> Handler
tty-emitter
only.Example implementation of Emitter is EmitterWriter
pub fn with_emitter_writer(
dst: Box<dyn Write + Send>,
cm: Option<Lrc<SourceMapperDyn>>
) -> Handler
pub fn with_emitter_writer(
dst: Box<dyn Write + Send>,
cm: Option<Lrc<SourceMapperDyn>>
) -> Handler
Calls Self::with_emitter with EmitterWriter.
Resets the diagnostic error count as well as the cached emitted diagnostics.
NOTE: DO NOT call this function from rustc. It is only meant to be
called from external tools that want to reuse a Parser
cleaning
the previously emitted diagnostics as well as the overall count of
emitted error diagnostics.
pub fn struct_span_warn<'a, S: Into<MultiSpan>>(
&'a self,
sp: S,
msg: &str
) -> DiagnosticBuilder<'a>
pub fn struct_span_warn_with_code<'a, S: Into<MultiSpan>>(
&'a self,
sp: S,
msg: &str,
code: DiagnosticId
) -> DiagnosticBuilder<'a>
pub fn struct_span_err<'a, S: Into<MultiSpan>>(
&'a self,
sp: S,
msg: &str
) -> DiagnosticBuilder<'a>
pub fn struct_span_err_with_code<'a, S: Into<MultiSpan>>(
&'a self,
sp: S,
msg: &str,
code: DiagnosticId
) -> DiagnosticBuilder<'a>
pub fn struct_err_with_code<'a>(
&'a self,
msg: &str,
code: DiagnosticId
) -> DiagnosticBuilder<'a>
pub fn struct_span_fatal<'a, S: Into<MultiSpan>>(
&'a self,
sp: S,
msg: &str
) -> DiagnosticBuilder<'a>
pub fn struct_span_fatal_with_code<'a, S: Into<MultiSpan>>(
&'a self,
sp: S,
msg: &str,
code: DiagnosticId
) -> DiagnosticBuilder<'a>
pub fn span_fatal_with_code<S: Into<MultiSpan>>(
&self,
sp: S,
msg: &str,
code: DiagnosticId
) -> FatalError
pub fn mut_span_err<'a, S: Into<MultiSpan>>(
&'a self,
sp: S,
msg: &str
) -> DiagnosticBuilder<'a>
true
if we haven’t taught a diagnostic with this code already.
The caller must then teach the user about such a diagnostic.
Used to suppress emitting the same error multiple times with extended
explanation when calling -Z teach
.
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Handler
impl !UnwindSafe for Handler
Blanket Implementations
type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
Converts some archived metadata to the pointer metadata for itself.
Mutably borrows from an owned value. Read more
impl<F, W, T, D> Deserialize<With<T, W>, D> for F where
W: DeserializeWith<F, T, D>,
D: Fallible + ?Sized,
F: ?Sized,
impl<F, W, T, D> Deserialize<With<T, W>, D> for F where
W: DeserializeWith<F, T, D>,
D: Fallible + ?Sized,
F: ?Sized,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more