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: Suggestions,
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: Suggestions
§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
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], &Suggestions, Vec<(&DiagArgName, &DiagArgValue)>, &Option<IsLint>)
fn keys( &self, ) -> (&Level, &[(DiagMessage, Style)], &Option<ErrCode>, &MultiSpan, &[Subdiag], &Suggestions, 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§
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)Source§impl<T, R> CollectAndApply<T, R> for T
impl<T, R> CollectAndApply<T, R> for T
Source§impl<T> Filterable for T
impl<T> Filterable for T
Source§fn filterable(
self,
filter_name: &'static str,
) -> RequestFilterDataProvider<T, fn(_: DataRequest<'_>) -> bool>
fn filterable( self, filter_name: &'static str, ) -> RequestFilterDataProvider<T, fn(_: DataRequest<'_>) -> bool>
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>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<I, T, U> Upcast<I, U> for Twhere
U: UpcastFrom<I, T>,
impl<I, T, U> Upcast<I, U> for Twhere
U: UpcastFrom<I, T>,
Source§impl<I, T> UpcastFrom<I, T> for T
impl<I, T> UpcastFrom<I, T> for T
fn upcast_from(from: T, _tcx: I) -> 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: 272 bytes