Add comment why thiserror is not used

This commit is contained in:
bjorn3
2021-03-19 16:41:39 +01:00
parent 84c79982e7
commit 82f3ad4f1a
6 changed files with 14 additions and 0 deletions

View File

@@ -103,6 +103,8 @@ pub enum DataValueCastFailure {
FromInteger(i64, Type), FromInteger(i64, Type),
} }
// This is manually implementing Error and Display instead of using thiserror to reduce the amount
// of dependencies used by Cranelift.
impl std::error::Error for DataValueCastFailure {} impl std::error::Error for DataValueCastFailure {}
impl Display for DataValueCastFailure { impl Display for DataValueCastFailure {

View File

@@ -186,6 +186,8 @@ pub enum LookupError {
Unsupported, Unsupported,
} }
// This is manually implementing Error and Display instead of using thiserror to reduce the amount
// of dependencies used by Cranelift.
impl std::error::Error for LookupError {} impl std::error::Error for LookupError {}
impl fmt::Display for LookupError { impl fmt::Display for LookupError {

View File

@@ -21,6 +21,8 @@ pub enum RegisterMappingError {
UnsupportedRegisterBank(&'static str), UnsupportedRegisterBank(&'static str),
} }
// This is manually implementing Error and Display instead of using thiserror to reduce the amount
// of dependencies used by Cranelift.
impl std::error::Error for RegisterMappingError {} impl std::error::Error for RegisterMappingError {}
impl std::fmt::Display for RegisterMappingError { impl std::fmt::Display for RegisterMappingError {

View File

@@ -41,6 +41,8 @@ pub enum CodegenError {
/// A convenient alias for a `Result` that uses `CodegenError` as the error type. /// A convenient alias for a `Result` that uses `CodegenError` as the error type.
pub type CodegenResult<T> = Result<T, CodegenError>; pub type CodegenResult<T> = Result<T, CodegenError>;
// This is manually implementing Error and Display instead of using thiserror to reduce the amount
// of dependencies used by Cranelift.
impl std::error::Error for CodegenError { impl std::error::Error for CodegenError {
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> { fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
match self { match self {

View File

@@ -102,6 +102,8 @@ pub struct VerifierError {
pub message: String, pub message: String,
} }
// This is manually implementing Error and Display instead of using thiserror to reduce the amount
// of dependencies used by Cranelift.
impl std::error::Error for VerifierError {} impl std::error::Error for VerifierError {}
impl Display for VerifierError { impl Display for VerifierError {
@@ -179,6 +181,8 @@ pub type VerifierResult<T> = Result<T, VerifierErrors>;
#[derive(Debug, Default, PartialEq, Eq, Clone)] #[derive(Debug, Default, PartialEq, Eq, Clone)]
pub struct VerifierErrors(pub Vec<VerifierError>); pub struct VerifierErrors(pub Vec<VerifierError>);
// This is manually implementing Error and Display instead of using thiserror to reduce the amount
// of dependencies used by Cranelift.
impl std::error::Error for VerifierErrors {} impl std::error::Error for VerifierErrors {}
impl VerifierErrors { impl VerifierErrors {

View File

@@ -192,6 +192,8 @@ pub enum ModuleError {
Backend(anyhow::Error), Backend(anyhow::Error),
} }
// This is manually implementing Error and Display instead of using thiserror to reduce the amount
// of dependencies used by Cranelift.
impl std::error::Error for ModuleError { impl std::error::Error for ModuleError {
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> { fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
match self { match self {