pub struct SourceError<E> { /* private fields */ }
Expand description
A wrapper around error types which includes a SourceLocation
.
This error is used to describe erros in the TableGen source file at a certain location.
By calling add_source_info
, information about the TableGen source file at
the SourceLocation
will be included in this error.
Implementations§
source§impl<E: Error> SourceError<E>
impl<E: Error> SourceError<E>
sourcepub fn new(location: SourceLocation, error: E) -> Self
pub fn new(location: SourceLocation, error: E) -> Self
Creates a new SourceError
.
pub fn location(&self) -> &SourceLocation
pub fn error(&self) -> &E
sourcepub fn set_error<F: Error>(self, error: F) -> SourceError<F>
pub fn set_error<F: Error>(self, error: F) -> SourceError<F>
Replaces the inner error with the given error.
Any source information that was previously attached with
SourceError::add_source_info
will be removed.
sourcepub fn set_location(self, location: impl SourceLoc) -> Self
pub fn set_location(self, location: impl SourceLoc) -> Self
Replaces the location.
Any source information that was previously attached with
SourceError::add_source_info
will be removed.
sourcepub fn add_source_info(self, info: SourceInfo<'_>) -> Self
pub fn add_source_info(self, info: SourceInfo<'_>) -> Self
Adds information about the TableGen source file at the
given SourceLocation
to this error.
A new error message will be created by SourceMgr
class of LLVM.
Trait Implementations§
source§impl<E: Clone> Clone for SourceError<E>
impl<E: Clone> Clone for SourceError<E>
source§fn clone(&self) -> SourceError<E>
fn clone(&self) -> SourceError<E>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl<E: Debug> Debug for SourceError<E>
impl<E: Debug> Debug for SourceError<E>
source§impl<E: Error> Display for SourceError<E>
impl<E: Error> Display for SourceError<E>
source§impl<E: Error + 'static> Error for SourceError<E>
impl<E: Error + 'static> Error for SourceError<E>
source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to_string()
source§impl From<TableGenError> for SourceError<TableGenError>
impl From<TableGenError> for SourceError<TableGenError>
source§fn from(value: TableGenError) -> Self
fn from(value: TableGenError) -> Self
Converts to this type from the input type.
source§impl<E: PartialEq> PartialEq for SourceError<E>
impl<E: PartialEq> PartialEq for SourceError<E>
impl<E: Eq> Eq for SourceError<E>
impl<E> StructuralPartialEq for SourceError<E>
Auto Trait Implementations§
impl<E> Freeze for SourceError<E>where
E: Freeze,
impl<E> RefUnwindSafe for SourceError<E>where
E: RefUnwindSafe,
impl<E> Send for SourceError<E>where
E: Send,
impl<E> Sync for SourceError<E>where
E: Sync,
impl<E> Unpin for SourceError<E>where
E: Unpin,
impl<E> UnwindSafe for SourceError<E>where
E: UnwindSafe,
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
Mutably borrows from an owned value. Read more
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)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)source§impl<E> WithLocation for Ewhere
E: Error,
impl<E> WithLocation for Ewhere
E: Error,
source§fn with_location<L: SourceLoc>(self, location: L) -> SourceError<Self>
fn with_location<L: SourceLoc>(self, location: L) -> SourceError<Self>
Creates a
SourceError
wrapper.