pub struct ErrorCtx<'ctx> {
pub continue_on_failure: bool,
pub error_on_warnings: bool,
pub dcx: DiagCtxtHandle<'ctx>,
pub external_decls_with_errors: HashSet<AnyTransId>,
pub ignored_failed_decls: HashSet<AnyTransId>,
external_dep_graph: DepGraph,
pub def_id: Option<AnyTransId>,
pub def_id_is_local: bool,
pub error_count: usize,
}
Expand description
The context for tracking and reporting errors.
Fields§
§continue_on_failure: bool
If true, do not abort on the first error and attempt to extract as much as possible.
error_on_warnings: bool
If true, print the warnings as errors, and abort if any errors were raised.
dcx: DiagCtxtHandle<'ctx>
The compiler session, used for displaying errors.
external_decls_with_errors: HashSet<AnyTransId>
The ids of the external_declarations for which extraction we encountered errors.
ignored_failed_decls: HashSet<AnyTransId>
The ids of the declarations we completely failed to extract and had to ignore.
external_dep_graph: DepGraph
Graph of dependencies between items: there is an edge from item a
to item b
if b
registered the id for a
during its translation. Because we only use this to report errors
on external items, we only record edges where a
is an external item.
def_id: Option<AnyTransId>
The id of the definition we are exploring, used to track the source of errors.
def_id_is_local: bool
Whether the definition being explored is local to the crate or not.
error_count: usize
The number of errors encountered so far.
Implementations§
source§impl<'ctx> ErrorCtx<'ctx>
impl<'ctx> ErrorCtx<'ctx>
pub fn new( continue_on_failure: bool, error_on_warnings: bool, dcx: DiagCtxtHandle<'ctx>, ) -> Self
pub fn continue_on_failure(&self) -> bool
pub(crate) fn has_errors(&self) -> bool
sourcepub fn span_err_no_register(
&self,
_krate: &TranslatedCrate,
span: impl Into<MultiSpan>,
msg: &str,
)
pub fn span_err_no_register( &self, _krate: &TranslatedCrate, span: impl Into<MultiSpan>, msg: &str, )
Report an error without registering anything.
sourcepub fn span_err(&mut self, krate: &TranslatedCrate, span: Span, msg: &str)
pub fn span_err(&mut self, krate: &TranslatedCrate, span: Span, msg: &str)
Report and register an error.
pub fn ignore_failed_decl(&mut self, id: AnyTransId)
sourcepub fn register_dep_source(
&mut self,
src: &Option<DepSource>,
item_id: AnyTransId,
is_local: bool,
)
pub fn register_dep_source( &mut self, src: &Option<DepSource>, item_id: AnyTransId, is_local: bool, )
Register the fact that id
is a dependency of src
(if src
is not None
).
sourcepub fn report_external_dep_error(&self, f: &FmtCtx<'_>, id: AnyTransId)
pub fn report_external_dep_error(&self, f: &FmtCtx<'_>, id: AnyTransId)
In case errors happened when extracting the definitions coming from the external dependencies, print a detailed report to explain to the user which dependencies were problematic, and where they are used in the code.
Auto Trait Implementations§
impl<'ctx> Freeze for ErrorCtx<'ctx>
impl<'ctx> !RefUnwindSafe for ErrorCtx<'ctx>
impl<'ctx> !Send for ErrorCtx<'ctx>
impl<'ctx> !Sync for ErrorCtx<'ctx>
impl<'ctx> Unpin for ErrorCtx<'ctx>
impl<'ctx> !UnwindSafe for ErrorCtx<'ctx>
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
§impl<I, T> ExtractContext<I, ()> for T
impl<I, T> ExtractContext<I, ()> for T
§fn extract_context(self, _original_input: I)
fn extract_context(self, _original_input: I)
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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 more