diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 46fb03b26..586d42513 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -38,23 +38,9 @@ jobs: --target thumbv7m-none-eabi --features async,defmt-03 - msrv-1-60: + msrv-1-81: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: dtolnay/rust-toolchain@1.60 - - run: > - cargo test - -p embedded-hal:1.0.0 - -p embedded-hal-bus - -p embedded-hal-nb - -p embedded-io - -p embedded-io-adapters - -p embedded-can - - msrv-1-75: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: dtolnay/rust-toolchain@1.75 + - uses: dtolnay/rust-toolchain@1.81 - run: cargo test --workspace --all-features diff --git a/README.md b/README.md index da60c3fed..63c347628 100644 --- a/README.md +++ b/README.md @@ -64,7 +64,7 @@ on crates.io. ## Minimum Supported Rust Version (MSRV) -This crate is guaranteed to compile on stable Rust 1.60 and up. It *might* +This crate is guaranteed to compile on stable Rust 1.81 and up. It *might* compile with older versions but that may change in any new patch release. See [here](docs/msrv.md) for details on how the MSRV may be upgraded. diff --git a/embedded-can/CHANGELOG.md b/embedded-can/CHANGELOG.md index 302c85a09..f8719d632 100644 --- a/embedded-can/CHANGELOG.md +++ b/embedded-can/CHANGELOG.md @@ -7,7 +7,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ## [Unreleased] -... +- Added `core::error::Error` implementations for every custom `impl Error` +- Increased MSRV to 1.81 due to `core::error::Error` ## [v0.4.1] - 2022-09-28 diff --git a/embedded-can/Cargo.toml b/embedded-can/Cargo.toml index 07ef7cc53..105f286b0 100644 --- a/embedded-can/Cargo.toml +++ b/embedded-can/Cargo.toml @@ -2,7 +2,7 @@ name = "embedded-can" version = "0.4.1" edition = "2021" -rust-version = "1.56" +rust-version = "1.81" description = "HAL traits for Controller Area Network (CAN) devices." categories = ["embedded", "hardware-support", "no-std"] diff --git a/embedded-can/src/lib.rs b/embedded-can/src/lib.rs index da561f58c..bb010b965 100644 --- a/embedded-can/src/lib.rs +++ b/embedded-can/src/lib.rs @@ -110,6 +110,8 @@ impl Error for ErrorKind { } } +impl core::error::Error for ErrorKind {} + impl core::fmt::Display for ErrorKind { fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { match self { diff --git a/embedded-hal-bus/CHANGELOG.md b/embedded-hal-bus/CHANGELOG.md index 45d0f6cc8..d9009d9c3 100644 --- a/embedded-hal-bus/CHANGELOG.md +++ b/embedded-hal-bus/CHANGELOG.md @@ -9,6 +9,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - Added the `alloc` feature. - Added a new `RcDevice` for I2C and SPI, a reference-counting equivalent to `RefCellDevice`. +- Migrated `std` feature-gated `std::error::Error` implementations to `core::error::Error` +- Increased MSRV to 1.81 due to `core::error::Error` ## [v0.2.0] - 2024-04-23 diff --git a/embedded-hal-bus/Cargo.toml b/embedded-hal-bus/Cargo.toml index d0ebecf7d..605f01b85 100644 --- a/embedded-hal-bus/Cargo.toml +++ b/embedded-hal-bus/Cargo.toml @@ -6,7 +6,7 @@ categories = ["embedded", "hardware-support", "no-std"] description = "Bus/Device connection mechanisms for embedded-hal, a Hardware Abstraction Layer (HAL) for embedded systems" documentation = "https://docs.rs/embedded-hal-bus" edition = "2021" -rust-version = "1.60" +rust-version = "1.81" keywords = ["hal", "IO"] license = "MIT OR Apache-2.0" name = "embedded-hal-bus" @@ -15,7 +15,7 @@ repository = "https://github.com/rust-embedded/embedded-hal" version = "0.2.0" [features] -# Enable shared bus implementations using `std::sync::Mutex`, and implement `std::error::Error` for `DeviceError` +# Enable shared bus implementations using `std::sync::Mutex` std = ["alloc"] # Use `portable-atomic` to enable `atomic-device` on devices without native atomic CAS # diff --git a/embedded-hal-bus/README.md b/embedded-hal-bus/README.md index 2e6d9db0d..6f767aae7 100644 --- a/embedded-hal-bus/README.md +++ b/embedded-hal-bus/README.md @@ -39,8 +39,7 @@ provides mechanisms to obtain multiple `I2c` instances out of a single `I2c` ins that does not natively support atomic CAS. If you enable this, you must also add `portable-atomic` to your crate with a feature flag such as `unsafe-assume-single-core` or `critical-section` to choose how atomic CAS is implemented. See for more info. -- **`std`**: enable shared bus implementations using `std::sync::Mutex`, and implement - `std::error::Error` for `DeviceError`. +- **`std`**: enable shared bus implementations using `std::sync::Mutex`. ## Minimum Supported Rust Version (MSRV) diff --git a/embedded-hal-bus/src/spi/mod.rs b/embedded-hal-bus/src/spi/mod.rs index 5a8356e28..c7a793f90 100644 --- a/embedded-hal-bus/src/spi/mod.rs +++ b/embedded-hal-bus/src/spi/mod.rs @@ -47,8 +47,7 @@ impl Display for DeviceError { } } -#[cfg(feature = "std")] -impl std::error::Error for DeviceError {} +impl core::error::Error for DeviceError {} impl Error for DeviceError where diff --git a/embedded-hal-nb/CHANGELOG.md b/embedded-hal-nb/CHANGELOG.md index f31190acb..63314c7cf 100644 --- a/embedded-hal-nb/CHANGELOG.md +++ b/embedded-hal-nb/CHANGELOG.md @@ -7,7 +7,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ## [Unreleased] -No unreleased changes +- Added `core::error::Error` implementations for every custom `impl Error` +- Increased MSRV to 1.81 due to `core::error::Error` ## [v1.0.0] - 2023-12-28 diff --git a/embedded-hal-nb/Cargo.toml b/embedded-hal-nb/Cargo.toml index d4575ead0..43a6cd7be 100644 --- a/embedded-hal-nb/Cargo.toml +++ b/embedded-hal-nb/Cargo.toml @@ -2,7 +2,7 @@ name = "embedded-hal-nb" version = "1.0.0" edition = "2021" -rust-version = "1.56" +rust-version = "1.81" categories = ["embedded", "hardware-support", "no-std"] description = "Non-blocking Hardware Abstraction Layer (HAL) for embedded systems using the `nb` crate." diff --git a/embedded-hal-nb/src/serial.rs b/embedded-hal-nb/src/serial.rs index 18d1265c2..2b0d504ef 100644 --- a/embedded-hal-nb/src/serial.rs +++ b/embedded-hal-nb/src/serial.rs @@ -45,6 +45,8 @@ impl Error for ErrorKind { } } +impl core::error::Error for ErrorKind {} + impl core::fmt::Display for ErrorKind { #[inline] fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { diff --git a/embedded-hal/CHANGELOG.md b/embedded-hal/CHANGELOG.md index 4a1af0e3f..e919e25ad 100644 --- a/embedded-hal/CHANGELOG.md +++ b/embedded-hal/CHANGELOG.md @@ -7,7 +7,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ## [Unreleased] -No unreleased changes yet. +- Added `core::error::Error` implementations for every custom `impl Error` +- Increased MSRV to 1.81 due to `core::error::Error` ## [v1.0.0] - 2023-12-28 diff --git a/embedded-hal/Cargo.toml b/embedded-hal/Cargo.toml index f67b2527b..011f3cc9d 100644 --- a/embedded-hal/Cargo.toml +++ b/embedded-hal/Cargo.toml @@ -8,7 +8,7 @@ categories = ["asynchronous", "embedded", "hardware-support", "no-std"] description = " A Hardware Abstraction Layer (HAL) for embedded systems " documentation = "https://docs.rs/embedded-hal" edition = "2021" -rust-version = "1.60" +rust-version = "1.81" keywords = ["hal", "IO"] license = "MIT OR Apache-2.0" name = "embedded-hal" diff --git a/embedded-hal/src/digital.rs b/embedded-hal/src/digital.rs index 201cd7637..a38040c0c 100644 --- a/embedded-hal/src/digital.rs +++ b/embedded-hal/src/digital.rs @@ -41,6 +41,8 @@ impl Error for ErrorKind { } } +impl core::error::Error for ErrorKind {} + impl core::fmt::Display for ErrorKind { #[inline] fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { diff --git a/embedded-hal/src/i2c.rs b/embedded-hal/src/i2c.rs index 36052afaf..3d042cd36 100644 --- a/embedded-hal/src/i2c.rs +++ b/embedded-hal/src/i2c.rs @@ -232,6 +232,8 @@ impl Error for ErrorKind { } } +impl core::error::Error for ErrorKind {} + impl core::fmt::Display for ErrorKind { #[inline] fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { diff --git a/embedded-hal/src/pwm.rs b/embedded-hal/src/pwm.rs index 68a94f54f..4d4ff1508 100644 --- a/embedded-hal/src/pwm.rs +++ b/embedded-hal/src/pwm.rs @@ -40,6 +40,8 @@ impl Error for ErrorKind { } } +impl core::error::Error for ErrorKind {} + impl core::fmt::Display for ErrorKind { #[inline] fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { diff --git a/embedded-hal/src/spi.rs b/embedded-hal/src/spi.rs index 508a4a9b1..55fc7e9fb 100644 --- a/embedded-hal/src/spi.rs +++ b/embedded-hal/src/spi.rs @@ -275,6 +275,8 @@ impl Error for ErrorKind { } } +impl core::error::Error for ErrorKind {} + impl core::fmt::Display for ErrorKind { #[inline] fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { diff --git a/embedded-io-async/README.md b/embedded-io-async/README.md index 744f6e6f2..8c5043593 100644 --- a/embedded-io-async/README.md +++ b/embedded-io-async/README.md @@ -12,7 +12,7 @@ This project is developed and maintained by the [HAL team](https://github.com/ru ## Optional Cargo features -- **`std`**: Adds `From` impls to convert to/from `std::io` structs, adds `std::error::Error` impls. +- **`std`**: Adds `From` impls to convert to/from `std::io` structs. - **`alloc`**: Adds blanket impls for `Box`, adds `Write` impl to `Vec`. - **`defmt-03`**: Derive `defmt::Format` from `defmt` 0.3 for enums and structs. diff --git a/embedded-io/CHANGELOG.md b/embedded-io/CHANGELOG.md index 286d1b707..1c8ea414c 100644 --- a/embedded-io/CHANGELOG.md +++ b/embedded-io/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## Unreleased + +- Added `core::error::Error` implementations for every custom `impl Error` +- Migrated `std` feature-gated `std::error::Error` implementations to `core::error::Error` +- Increased MSRV to 1.81 due to `core::error::Error` + ## 0.6.1 - 2023-10-22 - Make `SliceWriteError` publicly available. diff --git a/embedded-io/Cargo.toml b/embedded-io/Cargo.toml index e92714f7a..dc878f7b6 100644 --- a/embedded-io/Cargo.toml +++ b/embedded-io/Cargo.toml @@ -2,7 +2,7 @@ name = "embedded-io" version = "0.6.1" edition = "2021" -rust-version = "1.60" +rust-version = "1.81" description = "Embedded IO traits" repository = "https://github.com/rust-embedded/embedded-hal" readme = "README.md" diff --git a/embedded-io/README.md b/embedded-io/README.md index 04ea97771..6c228d8b4 100644 --- a/embedded-io/README.md +++ b/embedded-io/README.md @@ -21,7 +21,7 @@ targets. ## Optional Cargo features -- **`std`**: Adds `From` impls to convert to/from `std::io` structs, adds `std::error::Error` impls. +- **`std`**: Adds `From` impls to convert to/from `std::io` structs. - **`alloc`**: Adds blanket impls for `Box`, adds `Write` impl to `Vec`. - **`defmt-03`**: Derive `defmt::Format` from `defmt` 0.3 for enums and structs. diff --git a/embedded-io/src/impls/slice_mut.rs b/embedded-io/src/impls/slice_mut.rs index 4608ee45b..67606561b 100644 --- a/embedded-io/src/impls/slice_mut.rs +++ b/embedded-io/src/impls/slice_mut.rs @@ -19,9 +19,7 @@ impl core::fmt::Display for SliceWriteError { } } -#[cfg(feature = "std")] -#[cfg_attr(docsrs, doc(cfg(feature = "std")))] -impl std::error::Error for SliceWriteError {} +impl core::error::Error for SliceWriteError {} /// Write is implemented for `&mut [u8]` by copying into the slice, overwriting /// its data. diff --git a/embedded-io/src/lib.rs b/embedded-io/src/lib.rs index f050abb1d..ae5ff4853 100644 --- a/embedded-io/src/lib.rs +++ b/embedded-io/src/lib.rs @@ -193,6 +193,14 @@ impl Error for ErrorKind { } } +impl core::error::Error for ErrorKind {} + +impl fmt::Display for ErrorKind { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + write!(f, "{:?}", self) + } +} + #[cfg(feature = "std")] #[cfg_attr(docsrs, doc(cfg(feature = "std")))] impl Error for std::io::Error { @@ -255,9 +263,7 @@ impl fmt::Display for ReadExactError { } } -#[cfg(feature = "std")] -#[cfg_attr(docsrs, doc(cfg(feature = "std")))] -impl std::error::Error for ReadExactError {} +impl core::error::Error for ReadExactError {} /// Errors that could be returned by `Write` on `&mut [u8]`. #[derive(Debug, Copy, Clone, Eq, PartialEq)] @@ -290,9 +296,7 @@ impl fmt::Display for WriteFmtError { } } -#[cfg(feature = "std")] -#[cfg_attr(docsrs, doc(cfg(feature = "std")))] -impl std::error::Error for WriteFmtError {} +impl core::error::Error for WriteFmtError {} /// Blocking reader. ///