pub(crate) struct ErrorCtx {
pub continue_on_failure: bool,
pub error_on_warnings: bool,
pub external_decls_with_errors: HashSet<ItemId>,
external_dep_graph: DepGraph,
pub def_id: Option<ItemId>,
pub def_id_is_local: bool,
pub error_count: usize,
}Expand description
The context for tracking and reporting errors.
Fields§
§continue_on_failure: boolIf true, do not abort on the first error and attempt to extract as much as possible.
error_on_warnings: boolIf true, print the warnings as errors, and abort if any errors were raised.
external_decls_with_errors: HashSet<ItemId>The ids of the external_declarations for which extraction we encountered errors.
external_dep_graph: DepGraph§def_id: Option<ItemId>The id of the definition we are exploring, used to track the source of errors.
def_id_is_local: boolWhether the definition being explored is local to the crate or not.
error_count: usizeThe number of errors encountered so far.
Implementations§
Source§impl ErrorCtx
impl ErrorCtx
pub fn new(continue_on_failure: bool, error_on_warnings: bool) -> ErrorCtx
pub fn continue_on_failure(&self) -> bool
pub 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(
&mut self,
krate: &TranslatedCrate,
span: Span,
msg: &str,
level: Level<'_>,
) -> Error
pub fn span_err( &mut self, krate: &TranslatedCrate, span: Span, msg: &str, level: Level<'_>, ) -> Error
Report and register an error.
Sourcepub fn register_dep_source(
&mut self,
src: &Option<DepSource>,
item_id: ItemId,
is_local: bool,
)
pub fn register_dep_source( &mut self, src: &Option<DepSource>, item_id: ItemId, 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: ItemId)
pub fn report_external_dep_error(&self, krate: &TranslatedCrate, id: ItemId)
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