From 66fb09d98c688744266b4fbe329e27cdf2cb3c41 Mon Sep 17 00:00:00 2001 From: David Drysdale Date: Tue, 4 Nov 2025 15:34:58 +0000 Subject: [PATCH 1/2] Move MSRV to 1.81 1.81 is the Rust version that includes `core::error::Error`, released 2024-09-05. --- .github/workflows/ci.yml | 2 +- Cargo.lock | 2 +- Cargo.toml | 1 + README.md | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cb10811..ace4a39 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -93,7 +93,7 @@ jobs: strategy: fail-fast: false matrix: - rust: [1.58.0, 1.59.0] + rust: [1.81.0, 1.82.0] steps: - uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 with: diff --git a/Cargo.lock b/Cargo.lock index 3fe2a01..9c1283c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,6 +1,6 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 3 +version = 4 [[package]] name = "ciborium" diff --git a/Cargo.toml b/Cargo.toml index 1ce175c..fe72a00 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,6 +8,7 @@ description = "Set of types for supporting COSE" repository = "https://github.com/google/coset" keywords = ["cryptography", "cose"] categories = ["cryptography"] +rust-version = "1.81" [features] default = [] diff --git a/README.md b/README.md index 5fb69b6..7cdbe6a 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ This crate supports `no_std` (when the `std` feature is not set, which is the de ## Minimum Supported Rust Version -MSRV is 1.58. +MSRV is 1.81. ## Integer Ranges From c21a25dd743fe4bc9ea7be8876603a1106b01308 Mon Sep 17 00:00:00 2001 From: David Drysdale Date: Tue, 4 Nov 2025 15:26:40 +0000 Subject: [PATCH 2/2] Move to use core version of Error Also removes the `std` feature. --- Cargo.lock | 2 +- Cargo.toml | 7 +++++-- README.md | 4 +++- src/common/mod.rs | 3 +-- src/lib.rs | 2 +- src/util/mod.rs | 1 - 6 files changed, 11 insertions(+), 8 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 9c1283c..c484aaf 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -31,7 +31,7 @@ dependencies = [ [[package]] name = "coset" -version = "0.4.0" +version = "0.4.1" dependencies = [ "ciborium", "ciborium-io", diff --git a/Cargo.toml b/Cargo.toml index fe72a00..7df7c90 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "coset" -version = "0.4.0" +version = "0.4.1" authors = ["David Drysdale ", "Paul Crowley "] edition = "2018" license = "Apache-2.0" @@ -12,7 +12,10 @@ rust-version = "1.81" [features] default = [] -# `std` feature enables an `Error` impl for `CoseError` + +# The `std` feature is maintained for back-compatibility; it previously enabled a +# `std::error::Error` impl for `CoseError`, but the code now (always) has a +# `core::error::Error` impl. std = [] [dependencies] diff --git a/README.md b/README.md index 7cdbe6a..54994aa 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,9 @@ example](examples/signature.rs) for documentation on how to use the code. ## Features -The `std` feature of the crate enables an implementation of `std::error::Error` for `CoseError`. +The `std` feature of the crate does nothing, and is maintained for back-compatibility. (It previously +enabled an implementation of `std::error::Error` for `CoseError`, but there is now an implementation +of `core::error::Error` that is always present.) ## `no_std` Support diff --git a/src/common/mod.rs b/src/common/mod.rs index b2c6b78..3d9c630 100644 --- a/src/common/mod.rs +++ b/src/common/mod.rs @@ -95,8 +95,7 @@ impl core::fmt::Display for CoseError { } } -#[cfg(feature = "std")] -impl std::error::Error for CoseError {} +impl core::error::Error for CoseError {} impl CoseError { fn fmt_msg(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { diff --git a/src/lib.rs b/src/lib.rs index 1d1eed5..4ce9c93 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -96,7 +96,7 @@ //! [COSE]: https://tools.ietf.org/html/rfc8152 //! [CBOR]: https://tools.ietf.org/html/rfc7049 -#![cfg_attr(not(feature = "std"), no_std)] +#![no_std] #![deny(rustdoc::broken_intra_doc_links)] extern crate alloc; diff --git a/src/util/mod.rs b/src/util/mod.rs index 6da9bf4..79d6b1a 100644 --- a/src/util/mod.rs +++ b/src/util/mod.rs @@ -164,7 +164,6 @@ pub fn expect_err result: Result, err_msg: &str, ) { - #[cfg(not(feature = "std"))] use alloc::format; match result { Ok(_) => {