Skip to content

Commit

Permalink
chore(general): bump MSRV to 1.81, use core::error::Error on `no-st…
Browse files Browse the repository at this point in the history
…d` compatible crates (#1552)

* chore(general): use `core::error::Error` instead of `std::error::Error` on no-std compatible crates

For `no-std` compatible crates, we can use `core::error::Error` instead of `std::error::Error` to avoid gating the Error impl under `std`.

* chore: bump MSRV

* chore: std on 2718

* chore: readd std gate where alloy-rlp/ruint/const-hex have errs

* clippy

* chore: std on kzg
  • Loading branch information
Evalir authored Nov 28, 2024
1 parent b9aa9d4 commit 0913a7e
Show file tree
Hide file tree
Showing 9 changed files with 14 additions and 20 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
rust:
- "stable"
- "nightly"
- "1.79" # MSRV
- "1.81" # MSRV
flags:
# No features
- "--no-default-features"
Expand All @@ -34,7 +34,7 @@ jobs:
- "--all-features"
exclude:
# All features on MSRV
- rust: "1.79" # MSRV
- rust: "1.81" # MSRV
flags: "--all-features"
steps:
- uses: actions/checkout@v4
Expand All @@ -53,14 +53,14 @@ jobs:
cache-on-failure: true
# Only run tests on latest stable and above
- name: Install cargo-nextest
if: ${{ matrix.rust != '1.79' }} # MSRV
if: ${{ matrix.rust != '1.81' }} # MSRV
uses: taiki-e/install-action@nextest
- name: build
if: ${{ matrix.rust == '1.79' }} # MSRV
if: ${{ matrix.rust == '1.81' }} # MSRV
run: cargo build --workspace ${{ matrix.flags }}
- name: test
shell: bash
if: ${{ matrix.rust != '1.79' }} # MSRV
if: ${{ matrix.rust != '1.81' }} # MSRV
run: cargo nextest run --workspace ${{ matrix.flags }}

doctest:
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ resolver = "2"
[workspace.package]
version = "0.7.0"
edition = "2021"
rust-version = "1.79"
rust-version = "1.81"
authors = ["Alloy Contributors"]
license = "MIT OR Apache-2.0"
homepage = "https://github.com/alloy-rs/alloy"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ When updating this, also update:
- .github/workflows/ci.yml
-->

The current MSRV (minimum supported rust version) is 1.79.
The current MSRV (minimum supported rust version) is 1.81.

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
Expand Down
2 changes: 1 addition & 1 deletion clippy.toml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
msrv = "1.79"
msrv = "1.81"
6 changes: 2 additions & 4 deletions crates/eips/src/eip1898.rs
Original file line number Diff line number Diff line change
Expand Up @@ -277,8 +277,7 @@ impl Display for HexStringMissingPrefixError {
}
}

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

/// A Block Identifier.
/// <https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1898.md>
Expand Down Expand Up @@ -799,8 +798,7 @@ impl fmt::Display for ParseBlockHashOrNumberError {
}
}

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

impl FromStr for HashOrNumber {
type Err = ParseBlockHashOrNumberError;
Expand Down
3 changes: 1 addition & 2 deletions crates/eips/src/eip4844/trusted_setup_points.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,5 +131,4 @@ impl fmt::Display for KzgErrors {
}
}

#[cfg(feature = "std")]
impl std::error::Error for KzgErrors {}
impl core::error::Error for KzgErrors {}
3 changes: 1 addition & 2 deletions crates/rpc-types-engine/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,5 +120,4 @@ pub enum PayloadValidationError {
},
}

#[cfg(feature = "std")]
impl std::error::Error for PayloadValidationError {}
impl core::error::Error for PayloadValidationError {}
3 changes: 1 addition & 2 deletions crates/rpc-types-engine/src/forkchoice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,7 @@ pub enum ForkchoiceUpdateError {
UnknownFinalBlock,
}

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

#[cfg(feature = "jsonrpsee-types")]
impl From<ForkchoiceUpdateError> for jsonrpsee_types::error::ErrorObject<'static> {
Expand Down
3 changes: 1 addition & 2 deletions crates/rpc-types-eth/src/filter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,7 @@ pub enum FilterBlockError {
},
}

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

/// Represents the target range of blocks for the filter
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
Expand Down

0 comments on commit 0913a7e

Please sign in to comment.