Skip to main content

Error

Enum Error 

Source
pub enum Error {
    Opcode {
        func: String,
        opcode: String,
    },
    Virtual {
        func: String,
        opcode: String,
    },
    Encode {
        func: String,
        opcode: String,
        why: String,
    },
    Distance {
        func: String,
        bytes: i64,
    },
    Machine {
        triple: String,
    },
    Thread {
        name: String,
        format: &'static str,
    },
    IFunc {
        name: String,
    },
    Frame {
        func: String,
        why: String,
    },
    Image {
        name: String,
        why: String,
    },
}
Expand description

A function this compiler could not write out as assembly.

Neither of these is a program’s fault and neither should ever reach a user, since a machine function that reaches here has been through the whole backend and the tests pin both of the claims below. They are errors rather than assertions because the alternative to reporting one is writing a listing that is quietly wrong, and a wrong listing is the failure section 11.1 is written to prevent.

Variants§

§

Opcode

An opcode the target has no description of.

Fields

§func: String

The function it turned up in.

§opcode: String

The opcode, as the machine IR spells it.

§

Virtual

A register that is still virtual, which is a function that was never allocated.

Fields

§func: String

The function it turned up in.

§opcode: String

The opcode the register is an operand of.

§

Encode

An instruction the description names and the encoder could not write bytes for.

The two halves of the description are meant to hold the same instructions, and a test pins that they do, so this is either a row that was left out of one of them or an operand the machine cannot express in the instruction that was chosen for it.

Fields

§func: String

The function it turned up in.

§opcode: String

The opcode, as the machine IR spells it.

§why: String

What the encoder said, already formatted.

§

Distance

A jump inside a function to somewhere more than two gigabytes away.

A single function that long is not a program anybody wrote, and the four bytes a jump carries are all there are, so this is reported rather than wrapped around into a jump somewhere else entirely.

Fields

§func: String

The function it turned up in.

§bytes: i64

How far the jump would have had to reach.

§

Machine

A machine this crate cannot write assembly for.

Fields

§triple: String

The triple that was asked for.

§

Thread

A thread-local variable on a format that does not spell one the way ELF does.

The only one of these that is about a program rather than about this compiler. ELF says a thread-local variable with a section flag and a symbol type, and that is written. Windows hands out an index at load time and reaches the variable through a table the index names, and Mach-O puts a descriptor in front of every one and reaches it by calling through the descriptor, so on those two one is refused rather than written out as an ordinary variable that every thread would share.

Fields

§name: String

The variable, as the C program spelled it.

§format: &'static str

The object format that has no writing of one here, as its own name.

§

IFunc

An ifunc, which is not a mistake and not written yet.

The other thing an alias in the IR can be, and a different job from a second name for something: the symbol is resolved once at program start by calling a function in this object, which wants a symbol type of its own and a relocation of its own. One is refused rather than written as an ordinary alias that would go to the resolver instead of to what the resolver picked.

Fields

§name: String

The name it defines, as the C program spelled it.

§

Frame

A prologue the target’s unwind table has no way to describe.

ELF carries a little program per function and can say anything an instruction did to the frame. Windows carries a fixed list of codes instead, each one of a handful of shapes a prologue is allowed to have, and a prologue outside that list has no spelling there. The one this compiler writes that does not fit is the frame pointer form, which establishes the pointer before it takes the frame, so the table is refused rather than written describing a frame of the wrong size. A build that does not want a table at all is the way past it, which is -fno-asynchronous-unwind-tables -fno-unwind-tables.

Fields

§func: String

The function it turned up in.

§why: String

What about its prologue, already formatted.

§

Image

A piece of an initializer nothing here can write down.

Fields

§name: String

The variable it is part of.

§why: String

What about it, already formatted.

Trait Implementations§

Source§

impl Clone for Error

Source§

fn clone(&self) -> Error

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Error

Source§

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

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

impl Display for Error

Source§

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

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

impl Eq for Error

Source§

impl PartialEq for Error

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Error

Auto Trait Implementations§

§

impl Freeze for Error

§

impl RefUnwindSafe for Error

§

impl Send for Error

§

impl Sync for Error

§

impl Unpin for Error

§

impl UnsafeUnpin for Error

§

impl UnwindSafe for Error

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<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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 = !

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

fn try_from(value: U) -> Result<T, !>

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.