From dec19b4fa0b76a48efc56f4d93d9bd1a98f334ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rom=C3=A1n=20C=C3=A1rdenas=20Rodr=C3=ADguez?= Date: Mon, 3 Nov 2025 18:45:25 +0100 Subject: [PATCH 1/2] Mark result::Error as non-exhaustive --- riscv-types/CHANGELOG.md | 1 + riscv-types/src/result.rs | 1 + 2 files changed, 2 insertions(+) diff --git a/riscv-types/CHANGELOG.md b/riscv-types/CHANGELOG.md index 79236008..f1637b01 100644 --- a/riscv-types/CHANGELOG.md +++ b/riscv-types/CHANGELOG.md @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ### Changed +- Mark `result::Error` as `#[non_exhaustive]` to allow non-breaking new variants - Renamed crate to `riscv-types` as per [#351](https://github.com/rust-embedded/riscv/issues/351) ## riscv-pac [v0.2.0] - 2024-10-19 diff --git a/riscv-types/src/result.rs b/riscv-types/src/result.rs index b55c8beb..a099159d 100644 --- a/riscv-types/src/result.rs +++ b/riscv-types/src/result.rs @@ -5,6 +5,7 @@ pub type Result = core::result::Result; /// Represents error variants for the library. #[derive(Clone, Copy, Debug, Eq, PartialEq)] +#[non_exhaustive] pub enum Error { /// Attempted out-of-bounds access. IndexOutOfBounds { From 1b0f4088ad09dfe45885544006abda7b3591082b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rom=C3=A1n=20C=C3=A1rdenas=20Rodr=C3=ADguez?= Date: Mon, 3 Nov 2025 18:46:05 +0100 Subject: [PATCH 2/2] Implement core::error::Error --- riscv-types/CHANGELOG.md | 5 +++++ riscv-types/Cargo.toml | 2 +- riscv-types/README.md | 2 +- riscv-types/src/result.rs | 2 ++ 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/riscv-types/CHANGELOG.md b/riscv-types/CHANGELOG.md index f1637b01..70472503 100644 --- a/riscv-types/CHANGELOG.md +++ b/riscv-types/CHANGELOG.md @@ -9,9 +9,14 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ### Changed +- Bump MSRV to 1.81 due to `core::error::Error` trait - Mark `result::Error` as `#[non_exhaustive]` to allow non-breaking new variants - Renamed crate to `riscv-types` as per [#351](https://github.com/rust-embedded/riscv/issues/351) +### Added + +- Implement `core::error::Error` for `result::Error` + ## riscv-pac [v0.2.0] - 2024-10-19 ### Added diff --git a/riscv-types/Cargo.toml b/riscv-types/Cargo.toml index 63a6afc4..bfacb44b 100644 --- a/riscv-types/Cargo.toml +++ b/riscv-types/Cargo.toml @@ -2,7 +2,7 @@ name = "riscv-types" version = "0.1.0" edition = "2021" -rust-version = "1.60" +rust-version = "1.81" repository = "https://github.com/rust-embedded/riscv" authors = ["The RISC-V Team "] categories = ["embedded", "hardware-support", "no-std"] diff --git a/riscv-types/README.md b/riscv-types/README.md index 6745b98d..89f088d3 100644 --- a/riscv-types/README.md +++ b/riscv-types/README.md @@ -11,7 +11,7 @@ This project is developed and maintained by the [RISC-V team][team]. ## 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. ## License diff --git a/riscv-types/src/result.rs b/riscv-types/src/result.rs index a099159d..fa158529 100644 --- a/riscv-types/src/result.rs +++ b/riscv-types/src/result.rs @@ -57,3 +57,5 @@ impl fmt::Display for Error { } } } + +impl core::error::Error for Error {}