Skip to content

Commit 4a65734

Browse files
authored
fix: revert MSRV changes (#789)
* Revert "chore: bump MSRV to 1.81 & use `core::error::Error` in place of `std` (#780)" This reverts commit 7b84276. * Revert "chore: address MSRV TODOs for 1.81 (#781)" This reverts commit d37a5aa.
1 parent 0ee0afe commit 4a65734

File tree

14 files changed

+75
-33
lines changed

14 files changed

+75
-33
lines changed

.github/workflows/ci.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
rust: [
2525
"stable",
2626
"nightly",
27-
"1.81", # MSRV
27+
"1.79", # MSRV
2828
]
2929
flags: [
3030
# No features
@@ -35,10 +35,10 @@ jobs:
3535
include:
3636
# MSRV features
3737
- os: "ubuntu-latest"
38-
rust: "1.81" # MSRV
38+
rust: "1.79" # MSRV
3939
flags: "--features json"
4040
- os: "windows-latest"
41-
rust: "1.81" # MSRV
41+
rust: "1.79" # MSRV
4242
flags: "--features json"
4343
# All features
4444
- os: "ubuntu-latest"
@@ -57,10 +57,10 @@ jobs:
5757
cache-on-failure: true
5858
# Only run tests on latest stable and above
5959
- name: build
60-
if: ${{ matrix.rust == '1.81' }} # MSRV
60+
if: ${{ matrix.rust == '1.79' }} # MSRV
6161
run: cargo build --workspace ${{ matrix.flags }}
6262
- name: test
63-
if: ${{ matrix.rust != '1.81' }} # MSRV
63+
if: ${{ matrix.rust != '1.79' }} # MSRV
6464
run: cargo test --workspace ${{ matrix.flags }}
6565

6666
miri:

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ resolver = "2"
55
[workspace.package]
66
version = "0.8.9"
77
edition = "2021"
8-
rust-version = "1.81"
8+
rust-version = "1.79"
99
authors = ["Alloy Contributors"]
1010
license = "MIT OR Apache-2.0"
1111
homepage = "https://github.com/alloy-rs/core"

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ When updating this, also update:
5656
- .github/workflows/ci.yml
5757
-->
5858

59-
The current MSRV (minimum supported rust version) is 1.81.
59+
The current MSRV (minimum supported rust version) is 1.79.
6060

6161
Alloy will keep a rolling MSRV policy of **at least** two versions behind the
6262
latest stable release (so if the latest stable release is 1.58, we would

clippy.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
msrv = "1.81"
1+
msrv = "1.79"

crates/dyn-abi/src/coerce.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,8 @@ enum Error {
256256
EmptyHexStringWithoutPrefix,
257257
}
258258

259-
impl core::error::Error for Error {}
259+
#[cfg(feature = "std")]
260+
impl std::error::Error for Error {}
260261

261262
impl fmt::Display for Error {
262263
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {

crates/primitives/src/postgres.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ pub enum ToSqlError {
6363
Overflow(usize, Type),
6464
}
6565

66-
impl core::error::Error for ToSqlError {}
66+
impl std::error::Error for ToSqlError {}
6767

6868
/// Convert to Postgres types.
6969
///
@@ -225,7 +225,7 @@ pub enum FromSqlError {
225225
ParseError(Type),
226226
}
227227

228-
impl core::error::Error for FromSqlError {}
228+
impl std::error::Error for FromSqlError {}
229229

230230
impl<'a, const BITS: usize, const LIMBS: usize> FromSql<'a> for Signed<BITS, LIMBS> {
231231
fn accepts(ty: &Type) -> bool {

crates/primitives/src/signed/errors.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ impl fmt::Display for ParseSignedError {
4848
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
4949
pub struct BigIntConversionError;
5050

51-
impl core::error::Error for BigIntConversionError {}
51+
#[cfg(feature = "std")]
52+
impl std::error::Error for BigIntConversionError {}
5253

5354
impl fmt::Display for BigIntConversionError {
5455
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {

crates/sol-type-parser/src/error.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ pub type Result<T, E = Error> = core::result::Result<T, E>;
88
#[derive(Clone, PartialEq, Eq)]
99
pub struct Error(Repr);
1010

11-
impl core::error::Error for Error {}
11+
#[cfg(feature = "std")]
12+
impl std::error::Error for Error {}
1213

1314
impl fmt::Debug for Error {
1415
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {

crates/sol-type-parser/src/input.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ impl fmt::Display for CustomError {
1818
}
1919
}
2020

21-
impl core::error::Error for CustomError {}
21+
#[cfg(feature = "std")]
22+
impl std::error::Error for CustomError {}
2223

2324
pub type Input<'a> = winnow::Stateful<&'a str, RecursionCheck>;
2425

crates/sol-types/src/abi/encoder.rs

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,6 @@ impl Encoder {
4343
}
4444
}
4545

46-
/// Return a reference to the encoded words.
47-
#[inline]
48-
pub fn words(&self) -> &[Word] {
49-
&self.buf
50-
}
51-
5246
/// Finish the encoding process, returning the encoded words.
5347
///
5448
/// Use `into_bytes` instead to flatten the words into bytes.
@@ -59,18 +53,16 @@ impl Encoder {
5953
self.buf
6054
}
6155

62-
/// Return a reference to the encoded bytes.
63-
#[inline]
64-
pub fn bytes(&self) -> &[u8] {
65-
// SAFETY: `#[repr(transparent)] FixedBytes<N>([u8; N])`
66-
unsafe { &*(self.words() as *const [Word] as *const [[u8; 32]]) }.as_flattened()
67-
}
68-
6956
/// Finish the encoding process, returning the encoded bytes.
7057
#[inline]
7158
pub fn into_bytes(self) -> Vec<u8> {
59+
// TODO: remove once `Vec::into_flattened` is stabilized.
60+
// unsafe { mem::transmute::<Vec<_>, Vec<[u8; 32]>>(self.buf) }.into_flattened()
61+
7262
// SAFETY: `#[repr(transparent)] FixedBytes<N>([u8; N])`
73-
unsafe { mem::transmute::<Vec<Word>, Vec<[u8; 32]>>(self.finish()) }.into_flattened()
63+
crate::impl_core::into_flattened::<u8, 32>(unsafe {
64+
mem::transmute::<Vec<Word>, Vec<[u8; 32]>>(self.buf)
65+
})
7466
}
7567

7668
/// Determine the current suffix offset.

0 commit comments

Comments
 (0)