Struct rustc_ap_rustc_errors::Handler[][src]

pub struct Handler { /* fields omitted */ }
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.

Implementations

impl Handler[src]

pub fn with_tty_emitter(
    color_config: ColorConfig,
    can_emit_warnings: bool,
    treat_err_as_bug: Option<NonZeroUsize>,
    sm: Option<Lrc<SourceMap>>
) -> Self
[src]

pub fn with_tty_emitter_and_flags(
    color_config: ColorConfig,
    sm: Option<Lrc<SourceMap>>,
    flags: HandlerFlags
) -> Self
[src]

pub fn with_emitter(
    can_emit_warnings: bool,
    treat_err_as_bug: Option<NonZeroUsize>,
    emitter: Box<dyn Emitter + Send>
) -> Self
[src]

pub fn with_emitter_and_flags(
    emitter: Box<dyn Emitter + Send>,
    flags: HandlerFlags
) -> Self
[src]

pub fn can_emit_warnings(&self) -> bool[src]

pub fn reset_err_count(&self)[src]

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 stash_diagnostic(&self, span: Span, key: StashKey, diag: Diagnostic)[src]

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

pub fn steal_diagnostic(
    &self,
    span: Span,
    key: StashKey
) -> Option<DiagnosticBuilder<'_>>
[src]

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

pub fn emit_stashed_diagnostics(&self)[src]

Emit all stashed diagnostics.

pub fn struct_dummy(&self) -> DiagnosticBuilder<'_>[src]

Construct a dummy builder with Level::Cancelled.

Using this will neither report anything to the user (e.g. a warning), nor will compilation cancel as a result.

pub fn struct_span_warn(
    &self,
    span: impl Into<MultiSpan>,
    msg: &str
) -> DiagnosticBuilder<'_>
[src]

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

pub fn struct_span_allow(
    &self,
    span: impl Into<MultiSpan>,
    msg: &str
) -> DiagnosticBuilder<'_>
[src]

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

pub fn struct_span_warn_with_code(
    &self,
    span: impl Into<MultiSpan>,
    msg: &str,
    code: DiagnosticId
) -> DiagnosticBuilder<'_>
[src]

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

pub fn struct_warn(&self, msg: &str) -> DiagnosticBuilder<'_>[src]

Construct a builder at the Warning level with the msg.

pub fn struct_allow(&self, msg: &str) -> DiagnosticBuilder<'_>[src]

Construct a builder at the Allow level with the msg.

pub fn struct_span_err(
    &self,
    span: impl Into<MultiSpan>,
    msg: &str
) -> DiagnosticBuilder<'_>
[src]

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

pub fn struct_span_err_with_code(
    &self,
    span: impl Into<MultiSpan>,
    msg: &str,
    code: DiagnosticId
) -> DiagnosticBuilder<'_>
[src]

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

pub fn struct_err(&self, msg: &str) -> DiagnosticBuilder<'_>[src]

Construct a builder at the Error level with the msg.

pub fn struct_err_with_code(
    &self,
    msg: &str,
    code: DiagnosticId
) -> DiagnosticBuilder<'_>
[src]

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

pub fn struct_span_fatal(
    &self,
    span: impl Into<MultiSpan>,
    msg: &str
) -> DiagnosticBuilder<'_>
[src]

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

pub fn struct_span_fatal_with_code(
    &self,
    span: impl Into<MultiSpan>,
    msg: &str,
    code: DiagnosticId
) -> DiagnosticBuilder<'_>
[src]

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

pub fn struct_fatal(&self, msg: &str) -> DiagnosticBuilder<'_>[src]

Construct a builder at the Error level with the msg.

pub fn struct_help(&self, msg: &str) -> DiagnosticBuilder<'_>[src]

Construct a builder at the Help level with the msg.

pub fn struct_note_without_error(&self, msg: &str) -> DiagnosticBuilder<'_>[src]

Construct a builder at the Note level with the msg.

pub fn span_fatal(&self, span: impl Into<MultiSpan>, msg: &str) -> ![src]

pub fn span_fatal_with_code(
    &self,
    span: impl Into<MultiSpan>,
    msg: &str,
    code: DiagnosticId
) -> !
[src]

pub fn span_err(&self, span: impl Into<MultiSpan>, msg: &str)[src]

pub fn span_err_with_code(
    &self,
    span: impl Into<MultiSpan>,
    msg: &str,
    code: DiagnosticId
)
[src]

pub fn span_warn(&self, span: impl Into<MultiSpan>, msg: &str)[src]

pub fn span_warn_with_code(
    &self,
    span: impl Into<MultiSpan>,
    msg: &str,
    code: DiagnosticId
)
[src]

pub fn span_bug(&self, span: impl Into<MultiSpan>, msg: &str) -> ![src]

pub fn delay_span_bug(&self, span: impl Into<MultiSpan>, msg: &str)[src]

pub fn delay_good_path_bug(&self, msg: &str)[src]

pub fn span_bug_no_panic(&self, span: impl Into<MultiSpan>, msg: &str)[src]

pub fn span_note_without_error(&self, span: impl Into<MultiSpan>, msg: &str)[src]

pub fn span_note_diag(&self, span: Span, msg: &str) -> DiagnosticBuilder<'_>[src]

pub fn fatal(&self, msg: &str) -> FatalError[src]

pub fn err(&self, msg: &str)[src]

pub fn warn(&self, msg: &str)[src]

pub fn note_without_error(&self, msg: &str)[src]

pub fn bug(&self, msg: &str) -> ![src]

pub fn err_count(&self) -> usize[src]

pub fn has_errors(&self) -> bool[src]

pub fn has_errors_or_delayed_span_bugs(&self) -> bool[src]

pub fn print_error_count(&self, registry: &Registry)[src]

pub fn take_future_breakage_diagnostics(&self) -> Vec<Diagnostic>[src]

pub fn abort_if_errors(&self)[src]

pub fn must_teach(&self, code: &DiagnosticId) -> bool[src]

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.

pub fn force_print_diagnostic(&self, db: Diagnostic)[src]

pub fn emit_diagnostic(&self, diagnostic: &Diagnostic)[src]

pub fn emit_artifact_notification(&self, path: &Path, artifact_type: &str)[src]

pub fn emit_future_breakage_report(
    &self,
    diags: Vec<(FutureBreakage, Diagnostic)>
)
[src]

pub fn emit_unused_externs(&self, lint_level: &str, unused_externs: &[&str])[src]

pub fn delay_as_bug(&self, diagnostic: Diagnostic)[src]

Auto Trait Implementations

impl !RefUnwindSafe for Handler

impl !Send for Handler

impl !Sync for Handler

impl Unpin for Handler

impl !UnwindSafe for Handler

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T> Instrument for T[src]

fn instrument(self, span: Span) -> Instrumented<Self>[src]

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

fn in_current_span(self) -> Instrumented<Self>[src]

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T> MaybeResult<T> for T[src]

type Error = !

pub fn from(Result<T, <T as MaybeResult<T>>::Error>) -> T[src]

pub fn to_result(self) -> Result<T, <T as MaybeResult<T>>::Error>[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 

pub fn vzip(self) -> V

impl<'a, T> Captures<'a> for T where
    T: ?Sized
[src]

impl<T> Erased for T[src]