pub struct Handler {
    pub(crate) flags: HandlerFlags,
    pub(crate) inner: Lock<HandlerInner>,
}
Expand description

A handler deals with errors and other compiler output. Certain errors (fatal, bug, unimpl) may cause immediate exit, others log errors for later reporting.

Fields

flags: HandlerFlagsinner: Lock<HandlerInner>

Implementations

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.

Stash a given diagnostic with the given Span and StashKey as the key for later stealing.

Steal a previously stashed diagnostic with the given Span and StashKey as the key.

Emit all stashed diagnostics.

Construct a builder with the msg at the level appropriate for the specific EmissionGuarantee.

Construct a builder at the Warning level at the given span and with the msg.

Attempting to .emit() the builder will only emit if either:

  • can_emit_warnings is true
  • is_force_warn was set in DiagnosticId::Lint

Construct a builder at the Warning level at the given span and with the msg. The id is used for lint emissions which should also fulfill a lint expectation.

Attempting to .emit() the builder will only emit if either:

  • can_emit_warnings is true
  • is_force_warn was set in DiagnosticId::Lint

Construct a builder at the Allow level at the given span and with the msg.

Construct a builder at the Warning level at the given span and with the msg. Also include a code.

Construct a builder at the Warning level with the msg.

Attempting to .emit() the builder will only emit if either:

  • can_emit_warnings is true
  • is_force_warn was set in DiagnosticId::Lint

Construct a builder at the Warning level with the msg. The id is used for lint emissions which should also fulfill a lint expectation.

Attempting to .emit() the builder will only emit if either:

  • can_emit_warnings is true
  • is_force_warn was set in DiagnosticId::Lint

Construct a builder at the Allow level with the msg.

Construct a builder at the Expect level with the msg.

Construct a builder at the Error level at the given span and with the msg.

Construct a builder at the Error level at the given span, with the msg, and code.

Construct a builder at the Error level with the msg.

Construct a builder at the Error level with the msg and the code.

Construct a builder at the Warn level with the msg and the code.

Construct a builder at the Fatal level at the given span and with the msg.

Construct a builder at the Fatal level at the given span, with the msg, and code.

Construct a builder at the Error level with the msg.

Construct a builder at the Help level with the msg.

Construct a builder at the Note level with the msg.

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 -Zteach.

This methods steals all LintExpectationIds that are stored inside HandlerInner and indicate that the linked expectation has been fulfilled.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.

Layout

Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference’s “Type Layout” chapter for details on type layout guarantees.

Size: 408 bytes