oxilean_codegen/opt_ctfe/
ctfeerror_traits.rs1use super::types::CtfeError;
12use std::fmt;
13
14impl fmt::Display for CtfeError {
15 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
16 match self {
17 CtfeError::DivisionByZero => write!(f, "division by zero"),
18 CtfeError::IndexOutOfBounds { index, length } => {
19 write!(f, "index {} out of bounds (length {})", index, length)
20 }
21 CtfeError::StackOverflow { depth } => {
22 write!(f, "stack overflow at depth {}", depth)
23 }
24 CtfeError::NonConstant { reason } => write!(f, "non-constant: {}", reason),
25 CtfeError::Timeout { fuel_used } => {
26 write!(f, "timeout after {} steps", fuel_used)
27 }
28 CtfeError::Overflow { op } => write!(f, "integer overflow in {}", op),
29 CtfeError::BadProjection { field } => {
30 write!(f, "cannot project field {} from non-constructor", field)
31 }
32 CtfeError::NonExhaustiveMatch => write!(f, "non-exhaustive pattern match"),
33 }
34 }
35}