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)) -> PcodeError
pub fn new(ty: PcodeErrorTy, span: (usize, usize)) -> PcodeError
Creates an error carrying a source span.
Sourcepub fn spanless(ty: PcodeErrorTy) -> PcodeError
pub fn spanless(ty: PcodeErrorTy) -> PcodeError
Creates an error with no source span.
Sourcepub fn with_span(self, span: (usize, usize)) -> PcodeError
pub fn with_span(self, span: (usize, usize)) -> PcodeError
Attaches a source span, replacing any existing one.
Sourcepub fn range_out_of_bounds(
range: Range<usize>,
span: (usize, usize),
) -> PcodeError
pub fn range_out_of_bounds( range: Range<usize>, span: (usize, usize), ) -> PcodeError
A bit range that extends past the end of its subject.
Sourcepub fn argument_count_mismatch(
expected: usize,
actual: usize,
span: (usize, usize),
) -> PcodeError
pub fn argument_count_mismatch( expected: usize, actual: usize, span: (usize, usize), ) -> PcodeError
A macro invoked with the wrong number of arguments.
Sourcepub fn unknown_size(span: (usize, usize)) -> PcodeError
pub fn unknown_size(span: (usize, usize)) -> PcodeError
An expression whose size could not be determined.
Sourcepub fn unknown_macro(name: &str, span: (usize, usize)) -> PcodeError
pub fn unknown_macro(name: &str, span: (usize, usize)) -> PcodeError
A macro invoked but never defined.
Sourcepub fn multiple_exports(span: (usize, usize)) -> PcodeError
pub fn multiple_exports(span: (usize, usize)) -> PcodeError
A macro definition containing more than one export.
Sourcepub fn export_not_last(span: (usize, usize)) -> PcodeError
pub fn export_not_last(span: (usize, usize)) -> PcodeError
An export that is not the last statement in its macro definition.
Sourcepub fn function_is_a_statement(span: (usize, usize)) -> PcodeError
pub fn function_is_a_statement(span: (usize, usize)) -> PcodeError
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.