pub struct PcodeError {
pub ty: PcodeErrorTy,
pub span: Option<(usize, usize)>,
}Expand description
An error raised while lowering SLEIGH p-code, with an optional source span.
Fields§
§ty: PcodeErrorTyWhat went wrong.
span: Option<(usize, usize)>Byte range (start, end) into the prepared source, if available.
Implementations§
Source§impl PcodeError
impl PcodeError
Sourcepub fn new(ty: PcodeErrorTy, span: (usize, usize)) -> Self
pub fn new(ty: PcodeErrorTy, span: (usize, usize)) -> Self
Creates an error carrying a source span.
Sourcepub fn spanless(ty: PcodeErrorTy) -> Self
pub fn spanless(ty: PcodeErrorTy) -> Self
Creates an error with no source span.
Sourcepub fn with_span(self, span: (usize, usize)) -> Self
pub fn with_span(self, span: (usize, usize)) -> Self
Attaches a source span, replacing any existing one.
Sourcepub fn range_out_of_bounds(range: Range<usize>, span: (usize, usize)) -> Self
pub fn range_out_of_bounds(range: Range<usize>, span: (usize, usize)) -> Self
A bit range that extends past the end of its subject.
Sourcepub fn argument_count_mismatch(
expected: usize,
actual: usize,
span: (usize, usize),
) -> Self
pub fn argument_count_mismatch( expected: usize, actual: usize, span: (usize, usize), ) -> Self
A macro invoked with the wrong number of arguments.
Sourcepub fn unknown_size(span: (usize, usize)) -> Self
pub fn unknown_size(span: (usize, usize)) -> Self
An expression whose size could not be determined.
Sourcepub fn unknown_macro(name: &str, span: (usize, usize)) -> Self
pub fn unknown_macro(name: &str, span: (usize, usize)) -> Self
A macro invoked but never defined.
Sourcepub fn multiple_exports(span: (usize, usize)) -> Self
pub fn multiple_exports(span: (usize, usize)) -> Self
A macro definition containing more than one export.
Sourcepub fn export_not_last(span: (usize, usize)) -> Self
pub fn export_not_last(span: (usize, usize)) -> Self
An export that is not the last statement in its macro definition.
Sourcepub fn function_is_a_statement(span: (usize, usize)) -> Self
pub fn function_is_a_statement(span: (usize, usize)) -> Self
A statement-only construct used where an expression was expected.
Trait Implementations§
Source§impl Debug for PcodeError
impl Debug for PcodeError
Source§impl Display for PcodeError
impl Display for PcodeError
impl Eq for PcodeError
Source§impl Error for PcodeError
impl Error for PcodeError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Source§impl PartialEq for PcodeError
Spans are diagnostic detail, not identity: two errors of the same kind
compare equal regardless of where they were raised.
impl PartialEq for PcodeError
Spans are diagnostic detail, not identity: two errors of the same kind compare equal regardless of where they were raised.