Add a validation step back.

This commit is contained in:
2023-01-27 21:41:06 -08:00
parent afcf3c65cd
commit 3333dffa1e
6 changed files with 152 additions and 27 deletions

View File

@@ -8,7 +8,7 @@ use cranelift_codegen::isa::LookupError;
use cranelift_codegen::settings::{Configurable, SetError};
use cranelift_codegen::{isa, settings, CodegenError};
use cranelift_module::{default_libcall_names, ModuleCompiledFunction, ModuleError};
use cranelift_object::{ObjectBuilder, ObjectModule, object};
use cranelift_object::{object, ObjectBuilder, ObjectModule};
use target_lexicon::Triple;
use thiserror::Error;
@@ -36,24 +36,24 @@ pub enum BackendError {
impl From<BackendError> for Diagnostic<usize> {
fn from(value: BackendError) -> Self {
match value {
BackendError::Cranelift(me) =>
Diagnostic::error()
.with_message(format!("Internal cranelift error: {}", me)),
BackendError::BuiltinError(me) =>
Diagnostic::error()
.with_message(format!("Internal runtime function error: {}", me)),
BackendError::VariableLookupFailure =>
Diagnostic::error()
.with_message("Internal variable lookup error!"),
BackendError::CodegenError(me) =>
Diagnostic::error()
.with_message(format!("Internal codegen error: {}", me)),
BackendError::SetError(me) =>
Diagnostic::error()
.with_message(format!("Internal backend setup error: {}", me)),
BackendError::LookupError(me) =>
Diagnostic::error()
.with_message(format!("Internal error: {}", me)),
BackendError::Cranelift(me) => {
Diagnostic::error().with_message(format!("Internal cranelift error: {}", me))
}
BackendError::BuiltinError(me) => {
Diagnostic::error().with_message(format!("Internal runtime function error: {}", me))
}
BackendError::VariableLookupFailure => {
Diagnostic::error().with_message("Internal variable lookup error!")
}
BackendError::CodegenError(me) => {
Diagnostic::error().with_message(format!("Internal codegen error: {}", me))
}
BackendError::SetError(me) => {
Diagnostic::error().with_message(format!("Internal backend setup error: {}", me))
}
BackendError::LookupError(me) => {
Diagnostic::error().with_message(format!("Internal error: {}", me))
}
}
}
}