#[non_exhaustive]pub enum CompileError {
Invalid(ValidationError),
Select {
function: String,
error: IselError,
},
Allocate {
function: String,
error: RegAllocError,
},
Emit {
function: Option<String>,
error: EmitError,
},
}Expand description
Why a module could not be compiled.
§Examples
use backend_lang::{CompileError, Options};
use ir_lang::{Linkage, Module, Signature, Type};
let mut m = Module::new("m");
let f = m.declare_function("f", &Signature::new(&[], &[Type::F32]), Linkage::Export)?;
let mut b = m.build(f)?;
let x = b.f32const(1.0)?;
b.ret(&[x])?;
let err = backend_lang::compile(&m, &Options::sysv()).unwrap_err();
assert!(matches!(err, CompileError::Select { .. }));Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Invalid(ValidationError)
The module does not validate.
Select
Instruction selection failed for a function.
Allocate
Register allocation failed for a function.
Emit
Emission failed (for a function, if one is named).
Trait Implementations§
Source§impl Clone for CompileError
impl Clone for CompileError
Source§impl Debug for CompileError
impl Debug for CompileError
Source§impl Display for CompileError
impl Display for CompileError
impl Eq for CompileError
Source§impl Error for CompileError
impl Error for CompileError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
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
fn description(&self) -> &str
👎Deprecated since 1.42.0:
use the Display impl or to_string()
Source§impl PartialEq for CompileError
impl PartialEq for CompileError
impl StructuralPartialEq for CompileError
Auto Trait Implementations§
impl Freeze for CompileError
impl RefUnwindSafe for CompileError
impl Send for CompileError
impl Sync for CompileError
impl Unpin for CompileError
impl UnsafeUnpin for CompileError
impl UnwindSafe for CompileError
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
Mutably borrows from an owned value. Read more