oxilean_elab/instance/
instanceerror_traits.rs1use super::types::InstanceError;
12use std::fmt;
13
14impl std::fmt::Display for InstanceError {
15 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
16 match self {
17 InstanceError::NotFound { class } => {
18 write!(f, "no instance for class '{:?}'", class)
19 }
20 InstanceError::Ambiguous { class, candidates } => {
21 write!(
22 f,
23 "ambiguous instances for class '{:?}': {:?}",
24 class, candidates
25 )
26 }
27 InstanceError::MaxDepthExceeded { depth } => {
28 write!(f, "instance search exceeded max depth {}", depth)
29 }
30 InstanceError::CircularDependency { chain } => {
31 write!(f, "circular instance dependency: {:?}", chain)
32 }
33 InstanceError::UnresolvableSubgoal { instance, subgoal } => {
34 write!(
35 f,
36 "instance '{}' has unresolvable subgoal '{}'",
37 instance, subgoal
38 )
39 }
40 }
41 }
42}