Skip to content

Commit dd0bbba

Browse files
authored
Merge pull request #630 from rursprung/implement-core-error
implement `core::error::Error`
2 parents 0c31d81 + 91cf7e1 commit dd0bbba

File tree

24 files changed

+50
-41
lines changed

24 files changed

+50
-41
lines changed

.github/workflows/test.yml

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -38,23 +38,9 @@ jobs:
3838
--target thumbv7m-none-eabi
3939
--features async,defmt-03
4040
41-
msrv-1-60:
41+
msrv-1-81:
4242
runs-on: ubuntu-latest
4343
steps:
4444
- uses: actions/checkout@v4
45-
- uses: dtolnay/rust-toolchain@1.60
46-
- run: >
47-
cargo test
48-
-p embedded-hal:1.0.0
49-
-p embedded-hal-bus
50-
-p embedded-hal-nb
51-
-p embedded-io
52-
-p embedded-io-adapters
53-
-p embedded-can
54-
55-
msrv-1-75:
56-
runs-on: ubuntu-latest
57-
steps:
58-
- uses: actions/checkout@v4
59-
- uses: dtolnay/rust-toolchain@1.75
45+
- uses: dtolnay/rust-toolchain@1.81
6046
- run: cargo test --workspace --all-features

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ on crates.io.
6464

6565
## Minimum Supported Rust Version (MSRV)
6666

67-
This crate is guaranteed to compile on stable Rust 1.60 and up. It *might*
67+
This crate is guaranteed to compile on stable Rust 1.81 and up. It *might*
6868
compile with older versions but that may change in any new patch release.
6969

7070
See [here](docs/msrv.md) for details on how the MSRV may be upgraded.

embedded-can/CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
77

88
## [Unreleased]
99

10-
...
10+
- Added `core::error::Error` implementations for every custom `impl Error`
11+
- Increased MSRV to 1.81 due to `core::error::Error`
1112

1213
## [v0.4.1] - 2022-09-28
1314

embedded-can/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name = "embedded-can"
33
version = "0.4.1"
44
edition = "2021"
5-
rust-version = "1.56"
5+
rust-version = "1.81"
66

77
description = "HAL traits for Controller Area Network (CAN) devices."
88
categories = ["embedded", "hardware-support", "no-std"]

embedded-can/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,8 @@ impl Error for ErrorKind {
110110
}
111111
}
112112

113+
impl core::error::Error for ErrorKind {}
114+
113115
impl core::fmt::Display for ErrorKind {
114116
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
115117
match self {

embedded-hal-bus/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
99

1010
- Added the `alloc` feature.
1111
- Added a new `RcDevice` for I2C and SPI, a reference-counting equivalent to `RefCellDevice`.
12+
- Migrated `std` feature-gated `std::error::Error` implementations to `core::error::Error`
13+
- Increased MSRV to 1.81 due to `core::error::Error`
1214

1315
## [v0.2.0] - 2024-04-23
1416

embedded-hal-bus/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ categories = ["embedded", "hardware-support", "no-std"]
66
description = "Bus/Device connection mechanisms for embedded-hal, a Hardware Abstraction Layer (HAL) for embedded systems"
77
documentation = "https://docs.rs/embedded-hal-bus"
88
edition = "2021"
9-
rust-version = "1.60"
9+
rust-version = "1.81"
1010
keywords = ["hal", "IO"]
1111
license = "MIT OR Apache-2.0"
1212
name = "embedded-hal-bus"
@@ -15,7 +15,7 @@ repository = "https://github.com/rust-embedded/embedded-hal"
1515
version = "0.2.0"
1616

1717
[features]
18-
# Enable shared bus implementations using `std::sync::Mutex`, and implement `std::error::Error` for `DeviceError`
18+
# Enable shared bus implementations using `std::sync::Mutex`
1919
std = ["alloc"]
2020
# Use `portable-atomic` to enable `atomic-device` on devices without native atomic CAS
2121
#

embedded-hal-bus/README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,7 @@ provides mechanisms to obtain multiple `I2c` instances out of a single `I2c` ins
3939
that does not natively support atomic CAS. If you enable this, you must also add `portable-atomic` to your crate with
4040
a feature flag such as `unsafe-assume-single-core` or `critical-section` to choose how atomic CAS is implemented.
4141
See <https://docs.rs/portable-atomic/1.7.0/portable_atomic/#optional-features> for more info.
42-
- **`std`**: enable shared bus implementations using `std::sync::Mutex`, and implement
43-
`std::error::Error` for `DeviceError`.
42+
- **`std`**: enable shared bus implementations using `std::sync::Mutex`.
4443

4544
## Minimum Supported Rust Version (MSRV)
4645

embedded-hal-bus/src/spi/mod.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,7 @@ impl<BUS: Display, CS: Display> Display for DeviceError<BUS, CS> {
4747
}
4848
}
4949

50-
#[cfg(feature = "std")]
51-
impl<BUS: Debug + Display, CS: Debug + Display> std::error::Error for DeviceError<BUS, CS> {}
50+
impl<BUS: Debug + Display, CS: Debug + Display> core::error::Error for DeviceError<BUS, CS> {}
5251

5352
impl<BUS, CS> Error for DeviceError<BUS, CS>
5453
where

embedded-hal-nb/CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
77

88
## [Unreleased]
99

10-
No unreleased changes
10+
- Added `core::error::Error` implementations for every custom `impl Error`
11+
- Increased MSRV to 1.81 due to `core::error::Error`
1112

1213
## [v1.0.0] - 2023-12-28
1314

0 commit comments

Comments
 (0)