Module diagnostic

Source

Macros§

with_fn 🔒
Diag impls many &mut self -> &mut Self methods. Each one modifies an existing diagnostic, either in a standalone fashion, e.g. err.code(code);, or in a chained fashion to make multiple modifications, e.g. err.code(code).span(span);.

Structs§

BugAbort
Marker type which enables implementation of create_bug and emit_bug functions for bug diagnostics.
Diag
Used for emitting structured error messages and other diagnostic information. Wraps a DiagInner, adding some useful things.
DiagInner
The main part of a diagnostic. Note that Diag, which wraps this type, is used for most operations, and should be used instead whenever possible. This type should only be used when Diag’s lifetime causes difficulties, e.g. when storing diagnostics within DiagCtxt.
DiagLocation 🔒
DiagStyledString
FatalAbort
Marker type which enables implementation of create_fatal and emit_fatal functions for fatal diagnostics.
IsLint
StringPart
Subdiag
A “sub”-diagnostic attached to a parent diagnostic. For example, a note attached to an error.

Enums§

DiagArgValue
Simplified version of FluentValue that can implement Encodable and Decodable. Converted to a FluentValue by the emitter to be used in diagnostic translation.

Traits§

Diagnostic
Trait implemented by error types. This is rarely implemented manually. Instead, use #[derive(Diagnostic)] – see rustc_macros::Diagnostic.
EmissionGuarantee
Trait for types that Diag::emit can return as a “guarantee” (or “proof”) token that the emission happened.
IntoDiagArg
Converts a value of a type into a DiagArg (typically a field of an Diag struct). Implemented as a custom trait rather than From so that it is implemented on the type being converted rather than on DiagArgValue, which enables types from other rustc_* crates to implement this.
LintDiagnostic
Trait implemented by lint types. This should not be implemented manually. Instead, use #[derive(LintDiagnostic)] – see rustc_macros::LintDiagnostic.
Subdiagnostic
Trait implemented by error types. This should not be implemented manually. Instead, use #[derive(Subdiagnostic)] – see rustc_macros::Subdiagnostic.

Type Aliases§

DiagArg
Simplified version of FluentArg that can implement Encodable and Decodable. Collection of DiagArg are converted to FluentArgs (consuming the collection) at the start of diagnostic emission.
DiagArgMap
DiagArgName
Name of a diagnostic argument.

Trait Aliases§

SubdiagMessageOp