End-to-end testing of the compile path.
This commit is contained in:
@@ -18,6 +18,8 @@ pub enum BackendError {
|
||||
SetError(#[from] SetError),
|
||||
#[error(transparent)]
|
||||
LookupError(#[from] LookupError),
|
||||
#[error(transparent)]
|
||||
Write(#[from] cranelift_object::object::write::Error),
|
||||
}
|
||||
|
||||
impl From<BackendError> for Diagnostic<usize> {
|
||||
@@ -41,6 +43,41 @@ impl From<BackendError> for Diagnostic<usize> {
|
||||
BackendError::LookupError(me) => {
|
||||
Diagnostic::error().with_message(format!("Internal error: {}", me))
|
||||
}
|
||||
BackendError::Write(me) => {
|
||||
Diagnostic::error().with_message(format!("Cranelift object write error: {}", me))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl PartialEq for BackendError {
|
||||
fn eq(&self, other: &Self) -> bool {
|
||||
match self {
|
||||
BackendError::BuiltinError(a) => match other {
|
||||
BackendError::BuiltinError(b) => a == b,
|
||||
_ => false,
|
||||
},
|
||||
|
||||
BackendError::CodegenError(_) => matches!(other, BackendError::CodegenError(_)),
|
||||
|
||||
BackendError::Cranelift(_) => matches!(other, BackendError::Cranelift(_)),
|
||||
|
||||
BackendError::LookupError(a) => match other {
|
||||
BackendError::LookupError(b) => a == b,
|
||||
_ => false,
|
||||
},
|
||||
|
||||
BackendError::SetError(a) => match other {
|
||||
BackendError::SetError(b) => a == b,
|
||||
_ => false,
|
||||
},
|
||||
|
||||
BackendError::VariableLookupFailure => other == &BackendError::VariableLookupFailure,
|
||||
|
||||
BackendError::Write(a) => match other {
|
||||
BackendError::Write(b) => a == b,
|
||||
_ => false,
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user