diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 38a11d854b..57457dfb83 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -24,7 +24,7 @@ jobs: rust: [ "stable", "nightly", - "1.81", # MSRV + "1.79", # MSRV ] flags: [ # No features @@ -35,10 +35,10 @@ jobs: include: # MSRV features - os: "ubuntu-latest" - rust: "1.81" # MSRV + rust: "1.79" # MSRV flags: "--features json" - os: "windows-latest" - rust: "1.81" # MSRV + rust: "1.79" # MSRV flags: "--features json" # All features - os: "ubuntu-latest" @@ -57,10 +57,10 @@ jobs: cache-on-failure: true # Only run tests on latest stable and above - name: build - if: ${{ matrix.rust == '1.81' }} # MSRV + if: ${{ matrix.rust == '1.79' }} # MSRV run: cargo build --workspace ${{ matrix.flags }} - name: test - if: ${{ matrix.rust != '1.81' }} # MSRV + if: ${{ matrix.rust != '1.79' }} # MSRV run: cargo test --workspace ${{ matrix.flags }} miri: diff --git a/Cargo.toml b/Cargo.toml index 1f3f18f45e..477ca5a711 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,7 +5,7 @@ resolver = "2" [workspace.package] version = "0.8.9" edition = "2021" -rust-version = "1.81" +rust-version = "1.79" authors = ["Alloy Contributors"] license = "MIT OR Apache-2.0" homepage = "https://github.com/alloy-rs/core" diff --git a/README.md b/README.md index 513eac9450..da22c178d4 100644 --- a/README.md +++ b/README.md @@ -56,7 +56,7 @@ When updating this, also update: - .github/workflows/ci.yml --> -The current MSRV (minimum supported rust version) is 1.81. +The current MSRV (minimum supported rust version) is 1.79. Alloy will keep a rolling MSRV policy of **at least** two versions behind the latest stable release (so if the latest stable release is 1.58, we would diff --git a/clippy.toml b/clippy.toml index 8c0bc009eb..f1acf4b112 100644 --- a/clippy.toml +++ b/clippy.toml @@ -1 +1 @@ -msrv = "1.81" +msrv = "1.79" diff --git a/crates/dyn-abi/src/coerce.rs b/crates/dyn-abi/src/coerce.rs index 4f9bd781c2..0d23acc5f8 100644 --- a/crates/dyn-abi/src/coerce.rs +++ b/crates/dyn-abi/src/coerce.rs @@ -256,7 +256,8 @@ enum Error { EmptyHexStringWithoutPrefix, } -impl core::error::Error for Error {} +#[cfg(feature = "std")] +impl std::error::Error for Error {} impl fmt::Display for Error { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { diff --git a/crates/primitives/src/postgres.rs b/crates/primitives/src/postgres.rs index ba1c9f25a2..05fc29f508 100644 --- a/crates/primitives/src/postgres.rs +++ b/crates/primitives/src/postgres.rs @@ -63,7 +63,7 @@ pub enum ToSqlError { Overflow(usize, Type), } -impl core::error::Error for ToSqlError {} +impl std::error::Error for ToSqlError {} /// Convert to Postgres types. /// @@ -225,7 +225,7 @@ pub enum FromSqlError { ParseError(Type), } -impl core::error::Error for FromSqlError {} +impl std::error::Error for FromSqlError {} impl<'a, const BITS: usize, const LIMBS: usize> FromSql<'a> for Signed { fn accepts(ty: &Type) -> bool { diff --git a/crates/primitives/src/signed/errors.rs b/crates/primitives/src/signed/errors.rs index 72a303f7b1..b41c7c80cb 100644 --- a/crates/primitives/src/signed/errors.rs +++ b/crates/primitives/src/signed/errors.rs @@ -48,7 +48,8 @@ impl fmt::Display for ParseSignedError { #[derive(Clone, Copy, Debug, PartialEq, Eq)] pub struct BigIntConversionError; -impl core::error::Error for BigIntConversionError {} +#[cfg(feature = "std")] +impl std::error::Error for BigIntConversionError {} impl fmt::Display for BigIntConversionError { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { diff --git a/crates/sol-type-parser/src/error.rs b/crates/sol-type-parser/src/error.rs index 2bd87c9d10..3812fd0b93 100644 --- a/crates/sol-type-parser/src/error.rs +++ b/crates/sol-type-parser/src/error.rs @@ -8,7 +8,8 @@ pub type Result = core::result::Result; #[derive(Clone, PartialEq, Eq)] pub struct Error(Repr); -impl core::error::Error for Error {} +#[cfg(feature = "std")] +impl std::error::Error for Error {} impl fmt::Debug for Error { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { diff --git a/crates/sol-type-parser/src/input.rs b/crates/sol-type-parser/src/input.rs index 6af47b2d48..475304d6ed 100644 --- a/crates/sol-type-parser/src/input.rs +++ b/crates/sol-type-parser/src/input.rs @@ -18,7 +18,8 @@ impl fmt::Display for CustomError { } } -impl core::error::Error for CustomError {} +#[cfg(feature = "std")] +impl std::error::Error for CustomError {} pub type Input<'a> = winnow::Stateful<&'a str, RecursionCheck>; diff --git a/crates/sol-types/src/types/error.rs b/crates/sol-types/src/types/error.rs index 4ffbd003ee..25046d568f 100644 --- a/crates/sol-types/src/types/error.rs +++ b/crates/sol-types/src/types/error.rs @@ -103,7 +103,8 @@ impl fmt::Display for Revert { } } -impl core::error::Error for Revert {} +#[cfg(feature = "std")] +impl std::error::Error for Revert {} impl AsRef for Revert { #[inline] @@ -263,7 +264,8 @@ impl fmt::Display for Panic { } } -impl core::error::Error for Panic {} +#[cfg(feature = "std")] +impl std::error::Error for Panic {} impl SolError for Panic { type Parameters<'a> = (crate::sol_data::Uint<256>,); diff --git a/crates/sol-types/src/types/interface/mod.rs b/crates/sol-types/src/types/interface/mod.rs index a054cf1e3b..0491748be0 100644 --- a/crates/sol-types/src/types/interface/mod.rs +++ b/crates/sol-types/src/types/interface/mod.rs @@ -2,6 +2,9 @@ use crate::{alloc::string::ToString, Error, Panic, Result, Revert, SolError}; use alloc::{string::String, vec::Vec}; use core::{convert::Infallible, fmt, iter::FusedIterator, marker::PhantomData}; +#[cfg(feature = "std")] +use std::error::Error as StdError; + mod event; pub use event::SolEventInterface; @@ -208,9 +211,10 @@ impl fmt::Display for ContractError { } } -impl core::error::Error for ContractError { +#[cfg(feature = "std")] +impl StdError for ContractError { #[inline] - fn source(&self) -> Option<&(dyn core::error::Error + 'static)> { + fn source(&self) -> Option<&(dyn StdError + 'static)> { match self { Self::CustomError(error) => Some(error), Self::Panic(panic) => Some(panic), diff --git a/crates/syn-solidity/tests/contracts.rs b/crates/syn-solidity/tests/contracts.rs index 3b65b26164..c9fb26ea03 100644 --- a/crates/syn-solidity/tests/contracts.rs +++ b/crates/syn-solidity/tests/contracts.rs @@ -100,7 +100,7 @@ impl Drop for GitPatcher<'_> { } } -fn parse_file(path: &Path) -> Result> { +fn parse_file(path: &Path) -> Result> { let solidity = fs::read_to_string(path)?; syn::parse_str(&solidity).map_err(Into::into) }