panproto_jit/error.rs
1//! Error types for JIT compilation.
2
3use miette::Diagnostic;
4
5/// Errors from JIT compilation of panproto expressions.
6#[non_exhaustive]
7#[derive(Debug, thiserror::Error, Diagnostic)]
8pub enum JitError {
9 /// The expression contains an unsupported construct.
10 #[error("unsupported expression for JIT: {reason}")]
11 Unsupported {
12 /// What is unsupported and why.
13 reason: String,
14 },
15
16 /// LLVM IR generation failed.
17 #[error("LLVM codegen failed: {reason}")]
18 CodegenFailed {
19 /// Description of the codegen failure.
20 reason: String,
21 },
22
23 /// JIT compilation to native code failed.
24 #[error("JIT compilation failed: {reason}")]
25 CompilationFailed {
26 /// Description of the compilation failure.
27 reason: String,
28 },
29
30 /// The JIT runtime encountered an error during execution.
31 #[error("JIT runtime error: {reason}")]
32 RuntimeError {
33 /// Description of the runtime error.
34 reason: String,
35 },
36
37 /// The inkwell JIT backend is required but not enabled.
38 #[error("inkwell JIT not enabled; rebuild with --features=inkwell-jit")]
39 InkwellNotEnabled,
40}