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
Virtual
A register that is still virtual, which is a function that was never allocated.
Fields
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
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
Machine
A machine this crate cannot write assembly 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
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.
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
Image
A piece of an initializer nothing here can write down.
Trait Implementations§
impl Eq for Error
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> 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.