pub struct ErrorCtx {
pub continue_on_failure: bool,
pub error_on_warnings: bool,
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.
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 ErrorCtx
impl ErrorCtx
pub fn new(continue_on_failure: bool, error_on_warnings: bool) -> Self
pub fn continue_on_failure(&self) -> bool
pub(crate) fn has_errors(&self) -> bool
sourcepub fn display_error(
&self,
krate: &TranslatedCrate,
span: Span,
level: Level,
msg: String,
) -> Error
pub fn display_error( &self, krate: &TranslatedCrate, span: Span, level: Level, msg: String, ) -> Error
Report an error without registering anything.
sourcepub fn span_err_no_register(
&self,
krate: &TranslatedCrate,
span: Span,
msg: String,
) -> Error
pub fn span_err_no_register( &self, krate: &TranslatedCrate, span: Span, msg: String, ) -> Error
Report an error without registering anything.
sourcepub fn span_err(
&mut self,
krate: &TranslatedCrate,
span: Span,
msg: &str,
) -> Error
pub fn span_err( &mut self, krate: &TranslatedCrate, span: Span, msg: &str, ) -> Error
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, krate: &TranslatedCrate, id: AnyTransId)
pub fn report_external_dep_error(&self, krate: &TranslatedCrate, 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 Freeze for ErrorCtx
impl RefUnwindSafe for ErrorCtx
impl Send for ErrorCtx
impl Sync for ErrorCtx
impl Unpin for ErrorCtx
impl UnwindSafe for ErrorCtx
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