Skip to main content

AsmError

Enum AsmError 

Source
pub enum AsmError {
    UnknownMnemonic {
        mnemonic: String,
        arch: ArchName,
        span: Span,
    },
    InvalidOperands {
        detail: String,
        span: Span,
    },
    ImmediateOverflow {
        value: i128,
        min: i128,
        max: i128,
        span: Span,
    },
    UndefinedLabel {
        label: String,
        span: Span,
    },
    DuplicateLabel {
        label: String,
        span: Span,
        first_span: Span,
    },
    BranchOutOfRange {
        label: String,
        disp: i64,
        max: i64,
        span: Span,
    },
    Syntax {
        msg: String,
        span: Span,
    },
    RelaxationLimit {
        max: usize,
    },
    ResourceLimitExceeded {
        resource: String,
        limit: usize,
    },
    Multiple {
        errors: Vec<AsmError>,
    },
}
Expand description

Assembly error with source location and descriptive message.

Variants§

§

UnknownMnemonic

Unknown mnemonic for the target architecture.

Fields

§mnemonic: String

The mnemonic that was not recognized.

§arch: ArchName

The target architecture name.

§span: Span

Source location of the unknown mnemonic.

§

InvalidOperands

Invalid operand combination for the instruction.

Fields

§detail: String

Description of why the operands are invalid.

§span: Span

Source location of the instruction.

§

ImmediateOverflow

Immediate value exceeds the allowed range.

Fields

§value: i128

The immediate value that overflowed.

§min: i128

Minimum allowed value.

§max: i128

Maximum allowed value.

§span: Span

Source location of the immediate.

§

UndefinedLabel

Referenced label was never defined.

Fields

§label: String

The undefined label name.

§span: Span

Source location of the reference.

§

DuplicateLabel

Label was defined more than once.

Fields

§label: String

The duplicated label name.

§span: Span

Source location of the duplicate definition.

§first_span: Span

Source location of the first definition.

§

BranchOutOfRange

Branch target is out of range even after relaxation.

Fields

§label: String

The target label name.

§disp: i64

The actual displacement to the target.

§max: i64

Maximum allowed displacement.

§span: Span

Source location of the branch instruction.

§

Syntax

Syntax error during lexing or parsing.

Fields

§msg: String

The syntax error message.

§span: Span

Source location of the syntax error.

§

RelaxationLimit

Branch relaxation did not converge within the allowed number of passes.

Fields

§max: usize

Maximum number of relaxation passes allowed.

§

ResourceLimitExceeded

A configurable resource limit was exceeded (defense against DoS).

Fields

§resource: String

Human-readable name of the resource (e.g. “statements”, “labels”).

§limit: usize

The configured limit that was exceeded.

§

Multiple

Multiple errors collected during assembly.

Fields

§errors: Vec<AsmError>

The collected assembly errors.

Trait Implementations§

Source§

impl Clone for AsmError

Source§

fn clone(&self) -> AsmError

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for AsmError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for AsmError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Error for AsmError

Available on crate feature std only.
1.30.0 · Source§

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

👎Deprecated since 1.42.0: use the Display impl or to_string()
1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0: replaced by Error::source, which can support downcasting
Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl PartialEq for AsmError

Source§

fn eq(&self, other: &AsmError) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Eq for AsmError

Source§

impl StructuralPartialEq for AsmError

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.