Struct rustc_errors::DiagInner
source · pub struct DiagInner {
pub(crate) level: Level,
pub messages: Vec<(DiagMessage, Style)>,
pub code: Option<ErrCode>,
pub span: MultiSpan,
pub children: Vec<Subdiag>,
pub suggestions: Result<Vec<CodeSuggestion>, SuggestionsDisabled>,
pub args: DiagArgMap,
pub sort_span: Span,
pub is_lint: Option<IsLint>,
pub(crate) emitted_at: DiagLocation,
}
Expand description
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
.
Fields§
§level: Level
§messages: Vec<(DiagMessage, Style)>
§code: Option<ErrCode>
§span: MultiSpan
§children: Vec<Subdiag>
§suggestions: Result<Vec<CodeSuggestion>, SuggestionsDisabled>
§args: DiagArgMap
§sort_span: Span
This is not used for highlighting or rendering any error message. Rather, it can be used
as a sort key to sort a buffer of diagnostics. By default, it is the primary span of
span
if there is one. Otherwise, it is DUMMY_SP
.
is_lint: Option<IsLint>
§emitted_at: DiagLocation
With -Ztrack_diagnostics
enabled,
we print where in rustc this error was emitted.
Implementations§
source§impl DiagInner
impl DiagInner
pub fn new<M: Into<DiagMessage>>(level: Level, message: M) -> Self
pub fn new_with_messages( level: Level, messages: Vec<(DiagMessage, Style)> ) -> Self
pub fn level(&self) -> Level
pub fn is_error(&self) -> bool
pub(crate) fn update_unstable_expectation_id( &mut self, unstable_to_stable: &FxIndexMap<LintExpectationId, LintExpectationId> )
sourcepub(crate) fn has_future_breakage(&self) -> bool
pub(crate) fn has_future_breakage(&self) -> bool
Indicates whether this diagnostic should show up in cargo’s future breakage report.
pub(crate) fn is_force_warn(&self) -> bool
pub(crate) fn subdiagnostic_message_to_diagnostic_message( &self, attr: impl Into<SubdiagMessage> ) -> DiagMessage
pub(crate) fn sub( &mut self, level: Level, message: impl Into<SubdiagMessage>, span: MultiSpan )
pub(crate) fn arg( &mut self, name: impl Into<DiagArgName>, arg: impl IntoDiagArg )
sourcefn keys(
&self
) -> (&Level, &[(DiagMessage, Style)], &Option<ErrCode>, &MultiSpan, &[Subdiag], &Result<Vec<CodeSuggestion>, SuggestionsDisabled>, Vec<(&DiagArgName, &DiagArgValue)>, &Option<IsLint>)
fn keys( &self ) -> (&Level, &[(DiagMessage, Style)], &Option<ErrCode>, &MultiSpan, &[Subdiag], &Result<Vec<CodeSuggestion>, SuggestionsDisabled>, Vec<(&DiagArgName, &DiagArgValue)>, &Option<IsLint>)
Fields used for Hash, and PartialEq trait.
Trait Implementations§
source§impl<__D: SpanDecoder> Decodable<__D> for DiagInner
impl<__D: SpanDecoder> Decodable<__D> for DiagInner
source§impl<__E: SpanEncoder> Encodable<__E> for DiagInner
impl<__E: SpanEncoder> Encodable<__E> for DiagInner
Auto Trait Implementations§
impl DynSend for DiagInner
impl DynSync for DiagInner
impl Freeze for DiagInner
impl RefUnwindSafe for DiagInner
impl Send for DiagInner
impl Sync for DiagInner
impl Unpin for DiagInner
impl UnwindSafe for DiagInner
Blanket Implementations§
§impl<T> AnyEq for T
impl<T> AnyEq for T
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T, R> CollectAndApply<T, R> for T
impl<T, R> CollectAndApply<T, R> for T
§impl<T> Filterable for T
impl<T> Filterable for T
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
source§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
source§fn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
impl<'a, T> Captures<'a> for Twhere
T: ?Sized,
impl<T> ErasedDestructor for Twhere
T: 'static,
impl<T> MaybeSendSync for T
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: 280 bytes