Skip to content

Commit

Permalink
feat: Make Error trait available in no_std mode
Browse files Browse the repository at this point in the history
  • Loading branch information
sorairolake committed Oct 19, 2024
1 parent a3b071d commit 646ec3f
Show file tree
Hide file tree
Showing 15 changed files with 41 additions and 19 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/CI.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
- aarch64-apple-darwin
- x86_64-pc-windows-msvc
toolchain:
- 1.74.0 # MSRV
- 1.81.0 # MSRV
- stable
include:
- target: x86_64-unknown-linux-gnu
Expand Down Expand Up @@ -69,7 +69,7 @@ jobs:
strategy:
matrix:
toolchain:
- 1.74.0 # MSRV
- 1.81.0 # MSRV
- stable
steps:
- name: Checkout code
Expand Down Expand Up @@ -101,7 +101,7 @@ jobs:
- macos-14
- windows-2022
rust-version:
- 1.74.0 # MSRV
- 1.81.0 # MSRV
- stable
python-version:
- "3.8"
Expand Down Expand Up @@ -222,7 +222,7 @@ jobs:
strategy:
matrix:
toolchain:
- 1.74.0 # MSRV
- 1.81.0 # MSRV
- stable
steps:
- name: Checkout code
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ members = ["crates/*"]
[workspace.package]
authors = ["Shun Sakai <[email protected]>"]
edition = "2021"
rust-version = "1.74.0"
rust-version = "1.81.0"
homepage = "https://sorairolake.github.io/abcrypt/"
repository = "https://github.com/sorairolake/abcrypt"

Expand Down
2 changes: 1 addition & 1 deletion clippy.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
#
# SPDX-License-Identifier: Apache-2.0 OR MIT

msrv = "1.74.0"
msrv = "1.81.0"
7 changes: 7 additions & 0 deletions crates/abcrypt/CHANGELOG.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@ All notable changes to this project will be documented in this file.
The format is based on https://keepachangelog.com/[Keep a Changelog], and this
project adheres to https://semver.org/[Semantic Versioning].

== {compare-url}/abcrypt-v0.3.7\...HEAD[Unreleased]

=== Changed

* Make `Error` trait available in `no_std` mode ({pull-request-url}/556[#556])
* Bump MSRV to 1.81.0 ({pull-request-url}/556[#556])

== {compare-url}/abcrypt-v0.3.6\...abcrypt-v0.3.7[0.3.7] - 2024-10-19

=== Fixed
Expand Down
2 changes: 1 addition & 1 deletion crates/abcrypt/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ See the [documentation][docs-url] for more details.

## Minimum supported Rust version

The minimum supported Rust version (MSRV) of this library is v1.74.0.
The minimum supported Rust version (MSRV) of this library is v1.81.0.

## Source code

Expand Down
10 changes: 4 additions & 6 deletions crates/abcrypt/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

//! Error types for this crate.
use core::{fmt, result};
use core::{error, fmt, result};

use blake2::digest::MacError;

Expand Down Expand Up @@ -48,10 +48,9 @@ impl fmt::Display for Error {
}
}

#[cfg(feature = "std")]
impl std::error::Error for Error {
impl error::Error for Error {
#[inline]
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
fn source(&self) -> Option<&(dyn error::Error + 'static)> {
match self {
Self::InvalidArgon2Params(err) | Self::InvalidArgon2Context(err) => Some(err),
Self::InvalidHeaderMac(err) => Some(err),
Expand Down Expand Up @@ -409,10 +408,9 @@ mod tests {
);
}

#[cfg(feature = "std")]
#[test]
fn source() {
use std::error::Error as _;
use error::Error as _;

assert!(Error::InvalidLength.source().is_none());
assert!(Error::InvalidMagicNumber.source().is_none());
Expand Down
2 changes: 0 additions & 2 deletions crates/abcrypt/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,6 @@
#[cfg(feature = "alloc")]
#[macro_use]
extern crate alloc;
#[cfg(feature = "std")]
extern crate std;

mod decrypt;
mod encrypt;
Expand Down
1 change: 1 addition & 0 deletions crates/capi/CHANGELOG.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ project adheres to https://semver.org/[Semantic Versioning].

* Re-enable `clang-format` and `clang-tidy` on CI ({pull-request-url}/384[#384])
* Use `extern "C-unwind"` instead of `extern "C"` ({pull-request-url}/542[#542])
* Bump MSRV to 1.81.0 ({pull-request-url}/556[#556])

== {compare-url}/abcrypt-capi-v0.3.1\...abcrypt-capi-v0.3.2[0.3.2] - 2024-04-16

Expand Down
2 changes: 1 addition & 1 deletion crates/capi/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ fd -t directory out ./target/*/build/abcrypt-capi-*

## Minimum supported Rust version

The minimum supported Rust version (MSRV) of this library is v1.74.0.
The minimum supported Rust version (MSRV) of this library is v1.81.0.

## Source code

Expand Down
2 changes: 1 addition & 1 deletion crates/cli/BUILD.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
== Prerequisites

.To build *abcrypt*, you will need the following dependencies
* https://doc.rust-lang.org/stable/cargo/[Cargo] (v1.74.0 or later)
* https://doc.rust-lang.org/stable/cargo/[Cargo] (v1.81.0 or later)

.To build man pages, you will need the following additional dependencies
* https://asciidoctor.org/[Asciidoctor]
Expand Down
6 changes: 6 additions & 0 deletions crates/cli/CHANGELOG.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ All notable changes to this project will be documented in this file.
The format is based on https://keepachangelog.com/[Keep a Changelog], and this
project adheres to https://semver.org/[Semantic Versioning].

== {compare-url}/abcrypt-cli-v0.3.3\...HEAD[Unreleased]

=== Changed

* Bump MSRV to 1.81.0 ({pull-request-url}/556[#556])

== {compare-url}/abcrypt-cli-v0.3.2\...abcrypt-cli-v0.3.3[0.3.3] - 2024-08-04

=== Changed
Expand Down
6 changes: 6 additions & 0 deletions crates/python/CHANGELOG.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ All notable changes to this project will be documented in this file.
The format is based on https://keepachangelog.com/[Keep a Changelog], and this
project adheres to https://semver.org/[Semantic Versioning].

== {compare-url}/abcrypt-py-v0.1.4\...HEAD[Unreleased]

=== Changed

* Bump MSRV to 1.81.0 ({pull-request-url}/556[#556])

== {compare-url}/abcrypt-py-v0.1.3\...abcrypt-py-v0.1.4[0.1.4] - 2024-03-17

=== Fixed
Expand Down
2 changes: 1 addition & 1 deletion crates/python/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ See the [documentation][docs-url] for more details.

## Minimum supported Rust version

The minimum supported Rust version (MSRV) of this library is v1.74.0.
The minimum supported Rust version (MSRV) of this library is v1.81.0.

## Development

Expand Down
6 changes: 6 additions & 0 deletions crates/wasm/CHANGELOG.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ All notable changes to this project will be documented in this file.
The format is based on https://keepachangelog.com/[Keep a Changelog], and this
project adheres to https://semver.org/[Semantic Versioning].

== {compare-url}/abcrypt-wasm-v0.3.2\...HEAD[Unreleased]

=== Changed

* Bump MSRV to 1.81.0 ({pull-request-url}/556[#556])

== {compare-url}/abcrypt-wasm-v0.3.1\...abcrypt-wasm-v0.3.2[0.3.2] - 2024-02-28

=== Changed
Expand Down
2 changes: 1 addition & 1 deletion crates/wasm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ See the [documentation][docs-url] for more details.

## Minimum supported Rust version

The minimum supported Rust version (MSRV) of this library is v1.74.0.
The minimum supported Rust version (MSRV) of this library is v1.81.0.

## Source code

Expand Down

0 comments on commit 646ec3f

Please sign in to comment.