From 82f3ad4f1a412ae94958bb5eb82788bc95082b2a Mon Sep 17 00:00:00 2001 From: bjorn3 Date: Fri, 19 Mar 2021 16:41:39 +0100 Subject: [PATCH] Add comment why thiserror is not used --- cranelift/codegen/src/data_value.rs | 2 ++ cranelift/codegen/src/isa/mod.rs | 2 ++ cranelift/codegen/src/isa/unwind/systemv.rs | 2 ++ cranelift/codegen/src/result.rs | 2 ++ cranelift/codegen/src/verifier/mod.rs | 4 ++++ cranelift/module/src/module.rs | 2 ++ 6 files changed, 14 insertions(+) diff --git a/cranelift/codegen/src/data_value.rs b/cranelift/codegen/src/data_value.rs index 8819859f09..a317c7f394 100644 --- a/cranelift/codegen/src/data_value.rs +++ b/cranelift/codegen/src/data_value.rs @@ -103,6 +103,8 @@ pub enum DataValueCastFailure { 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 Display for DataValueCastFailure { diff --git a/cranelift/codegen/src/isa/mod.rs b/cranelift/codegen/src/isa/mod.rs index 811ad8c9d7..fccb46f7a6 100644 --- a/cranelift/codegen/src/isa/mod.rs +++ b/cranelift/codegen/src/isa/mod.rs @@ -186,6 +186,8 @@ pub enum LookupError { 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 fmt::Display for LookupError { diff --git a/cranelift/codegen/src/isa/unwind/systemv.rs b/cranelift/codegen/src/isa/unwind/systemv.rs index 9e537907a8..da3bfea869 100644 --- a/cranelift/codegen/src/isa/unwind/systemv.rs +++ b/cranelift/codegen/src/isa/unwind/systemv.rs @@ -21,6 +21,8 @@ pub enum RegisterMappingError { 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::fmt::Display for RegisterMappingError { diff --git a/cranelift/codegen/src/result.rs b/cranelift/codegen/src/result.rs index aa264c7601..3178cd5ba9 100644 --- a/cranelift/codegen/src/result.rs +++ b/cranelift/codegen/src/result.rs @@ -41,6 +41,8 @@ pub enum CodegenError { /// A convenient alias for a `Result` that uses `CodegenError` as the error type. pub type CodegenResult = Result; +// 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 { fn source(&self) -> Option<&(dyn std::error::Error + 'static)> { match self { diff --git a/cranelift/codegen/src/verifier/mod.rs b/cranelift/codegen/src/verifier/mod.rs index 7c64c0464c..1d1801016b 100644 --- a/cranelift/codegen/src/verifier/mod.rs +++ b/cranelift/codegen/src/verifier/mod.rs @@ -102,6 +102,8 @@ pub struct VerifierError { 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 Display for VerifierError { @@ -179,6 +181,8 @@ pub type VerifierResult = Result; #[derive(Debug, Default, PartialEq, Eq, Clone)] pub struct VerifierErrors(pub Vec); +// 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 VerifierErrors { diff --git a/cranelift/module/src/module.rs b/cranelift/module/src/module.rs index 97db899342..191d468ed7 100644 --- a/cranelift/module/src/module.rs +++ b/cranelift/module/src/module.rs @@ -192,6 +192,8 @@ pub enum ModuleError { 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 { fn source(&self) -> Option<&(dyn std::error::Error + 'static)> { match self {