use std::any::TypeId;
use std::error::Error;
use std::fmt::{Display, Formatter};
use edlc_core::prelude::mir_type::MirTypeId;
use cranelift_module::ModuleError;
use crate::prelude::RuntimeId;
#[derive(Debug)]
pub enum JITErrorType {
TypeMismatch(MirTypeId, String),
ModuleErr(ModuleError),
MissingReturnType(String),
InvalidRuntimeData(RuntimeId),
RuntimeDataState(RuntimeId, String),
RuntimeError(String),
RuntimePanic(Vec<String>),
NoRustRepr(MirTypeId),
RustTypeMismatch(TypeId, TypeId),
}
#[derive(Debug)]
pub struct JITError {
pub ty: JITErrorType
}
impl Display for JITError {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
write!(f, "{:?}", self)
}
}
impl Error for JITError {}