Skip to content

Commit

Permalink
revert to Rust 1.80
Browse files Browse the repository at this point in the history
  • Loading branch information
Wodann committed Sep 17, 2024
1 parent 31771cc commit f260074
Show file tree
Hide file tree
Showing 10 changed files with 34 additions and 15 deletions.
6 changes: 4 additions & 2 deletions crates/interpreter/src/interpreter/analysis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,8 @@ impl fmt::Display for EofError {
}
}

impl core::error::Error for EofError {}
#[cfg(feature = "std")]
impl std::error::Error for EofError {}

#[derive(Debug, Hash, PartialEq, Eq, PartialOrd, Ord, Clone, Copy)]
pub enum EofValidationError {
Expand Down Expand Up @@ -441,7 +442,8 @@ impl fmt::Display for EofValidationError {
}
}

impl core::error::Error for EofValidationError {}
#[cfg(feature = "std")]
impl std::error::Error for EofValidationError {}

/// Validates that:
/// * All instructions are valid.
Expand Down
4 changes: 2 additions & 2 deletions crates/interpreter/src/opcode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ impl fmt::Display for OpCodeError {
}
}

#[cfg(feature = "parse")]
impl core::error::Error for OpCodeError {}
#[cfg(all(feature = "parse", feature = "std"))]
impl std::error::Error for OpCodeError {}

/// An EVM opcode.
///
Expand Down
3 changes: 2 additions & 1 deletion crates/optimism/src/result.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ impl Display for OptimismInvalidTransaction {
}
}

impl core::error::Error for OptimismInvalidTransaction {}
#[cfg(feature = "std")]
impl std::error::Error for OptimismInvalidTransaction {}

impl From<InvalidTransaction> for OptimismInvalidTransaction {
fn from(value: InvalidTransaction) -> Self {
Expand Down
3 changes: 2 additions & 1 deletion crates/primitives/src/bytecode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,8 @@ impl From<Eip7702DecodeError> for BytecodeDecodeError {
}
}

impl core::error::Error for BytecodeDecodeError {}
#[cfg(feature = "std")]
impl std::error::Error for BytecodeDecodeError {}

impl fmt::Display for BytecodeDecodeError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
Expand Down
3 changes: 2 additions & 1 deletion crates/primitives/src/bytecode/eof.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,8 @@ impl fmt::Display for EofDecodeError {
}
}

impl core::error::Error for EofDecodeError {}
#[cfg(feature = "std")]
impl std::error::Error for EofDecodeError {}

#[cfg(test)]
mod test {
Expand Down
3 changes: 2 additions & 1 deletion crates/primitives/src/eip7702/bytecode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@ impl fmt::Display for Eip7702DecodeError {
}
}

impl core::error::Error for Eip7702DecodeError {}
#[cfg(feature = "std")]
impl std::error::Error for Eip7702DecodeError {}

#[cfg(test)]
mod tests {
Expand Down
13 changes: 11 additions & 2 deletions crates/primitives/src/evm_wiring.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use cfg_if::cfg_if;

use crate::{db::Database, Block, SpecId, Transaction};
use core::{fmt::Debug, hash::Hash};

Expand All @@ -17,8 +19,15 @@ impl<HaltReasonT> HaltReasonTrait for HaltReasonT where
}

pub trait TransactionValidation {
/// An error that occurs when validating a transaction.
type ValidationError: Debug + core::error::Error;
cfg_if! {
if #[cfg(feature = "std")] {
/// An error that occurs when validating a transaction.
type ValidationError: Debug + std::error::Error;
} else {
/// An error that occurs when validating a transaction.
type ValidationError: Debug;
}
}
}

pub trait ChainSpec: Sized {
Expand Down
6 changes: 4 additions & 2 deletions crates/primitives/src/precompile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,8 @@ pub enum PrecompileErrors {
Fatal { msg: String },
}

impl core::error::Error for PrecompileErrors {}
#[cfg(feature = "std")]
impl std::error::Error for PrecompileErrors {}

impl fmt::Display for PrecompileErrors {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
Expand Down Expand Up @@ -195,7 +196,8 @@ impl From<PrecompileError> for PrecompileErrors {
}
}

impl core::error::Error for PrecompileError {}
#[cfg(feature = "std")]
impl std::error::Error for PrecompileError {}

impl fmt::Display for PrecompileError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
Expand Down
6 changes: 4 additions & 2 deletions crates/primitives/src/result.rs
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,8 @@ impl From<InvalidAuthorization> for InvalidTransaction {
}
}

impl core::error::Error for InvalidTransaction {}
#[cfg(feature = "std")]
impl std::error::Error for InvalidTransaction {}

impl fmt::Display for InvalidTransaction {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
Expand Down Expand Up @@ -389,7 +390,8 @@ pub enum InvalidHeader {
ExcessBlobGasNotSet,
}

impl core::error::Error for InvalidHeader {}
#[cfg(feature = "std")]
impl std::error::Error for InvalidHeader {}

impl fmt::Display for InvalidHeader {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
Expand Down
2 changes: 1 addition & 1 deletion examples/db_by_ref.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use core::error::Error;
use core::fmt::Debug;
use revm::{
db::{CacheDB, EmptyDB, WrapDatabaseRef},
Expand All @@ -8,6 +7,7 @@ use revm::{
primitives::{EthereumWiring, HaltReason, ResultAndState},
DatabaseCommit, DatabaseRef, Evm,
};
use std::error::Error;

trait DatabaseRefDebugError: DatabaseRef<Error = Self::DBError> {
type DBError: std::fmt::Debug + Error + Send + Sync + 'static;
Expand Down

0 comments on commit f260074

Please sign in to comment.