Skip to main content

Module diagnostics

Module diagnostics 

Source
Expand description

Diagnostics implementation.

Modified from rustc’s diagnostic.rs and lib.rs.

Structs§

BugAbort
Marker type which enables implementation of create_bug and emit_bug functions for bug diagnostics.
CodeSuggestion
A structured suggestion for code changes. Based on rustc’s CodeSuggestion structure.
DeferredDiagnostics
Diagnostics withheld by DiagCtxt::defer, to be emitted with DiagCtxt::emit_deferred.
Diag
A compiler diagnostic.
DiagBuilder
Used for emitting structured error messages and other diagnostic information.
DiagCtxt
A handler that deals with errors and other compiler output.
DiagCtxtFlags
Flags that control the behaviour of a DiagCtxt.
DiagId
Diag ID.
DiagMsg
EmittedDiagnostics
Represents all the diagnostics emitted up to a certain point.
ErrorGuaranteed
Useful type to use with Result indicate that an error has already been reported to the user, so no need to continue checking.
ExplicitBug
Signifies that the compiler died with an explicit call to .bug rather than a failed assertion, etc.
FatalAbort
Marker type which enables implementation of fatal diagnostics.
HumanBufferEmitter
Diagnostic emitter that emits diagnostics in human-readable format to a local buffer.
HumanEmitter
Diagnostic emitter that emits to an arbitrary io::Write writer in human-readable format.
InMemoryEmitter
An in-memory diagnostics emitter.
JsonDiagnosticjson
A rustc-like JSON diagnostic emitted by JsonEmitter.
JsonDiagnosticCodejson
A diagnostic code in a rustc-like JSON diagnostic.
JsonDiagnosticSpanjson
A source span in a rustc-like JSON diagnostic.
JsonDiagnosticSpanLinejson
A source line in a rustc-like JSON diagnostic span.
JsonDiagnosticSpanMacroExpansionjson
A macro expansion represented in a rustc-like JSON diagnostic span.
JsonEmitterjson
Diagnostic emitter that emits diagnostics as JSON.
LocalEmitter
Diagnostic emitter that only stores emitted diagnostics.
MultiSpan
A collection of Spans.
SilentEmitter
Diagnostic emitter.
SolcDiagnosticjson
SourceLocationjson
SpanLabel
A span together with some additional data.
SubDiagnostic
A “sub”-diagnostic attached to a parent diagnostic. For example, a note attached to an error.
Substitution
A substitution represents a single alternative fix consisting of multiple parts.
SubstitutionPart
A single part of a substitution, indicating a specific span to replace with a snippet.

Enums§

Applicability
Indicates the confidence in the correctness of a suggestion.
ConfusionType
Represents the type of confusion detected between original and suggested code.
JsonDiagnosticMessagejson
A rustc-like JSON message emitted by JsonEmitter::rustc_like.
Level
Diag level.
Severityjson
Style
SuggestionStyle
Suggestions
Represents the help messages seen on a diagnostic.

Traits§

EmissionGuarantee
Trait for types that DiagBuilder::emit can return as a “guarantee” (or “proof”) token that the emission happened.
Emitter
Diagnostic emitter.

Functions§

detect_confusion_type
Whether the original and suggested code are visually similar enough to warrant extra wording.
flush_withheld
Emits every diagnostic that a DiagCtxt::defer on any thread still withholds, in the order that they first withheld one. This is best effort, for a panic that is about to end the program, where the work that holds them cannot finish: a thread that holds a context’s lock for longer than a moment is skipped.
is_different
Whether the original and suggested code are the same.

Type Aliases§

DynEmitter
Dynamic diagnostic emitter. See Emitter.