From d9b4e763718a8707c204ac8132deb5938f9cb3bc Mon Sep 17 00:00:00 2001 From: David Cruz Date: Tue, 9 Sep 2025 00:43:52 -0700 Subject: [PATCH 1/3] Replace std::error::Error with core::error::Error This was stabilized in Rust 1.81 and was pointed out by the comment above the impl. --- capstone-rs/src/error.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/capstone-rs/src/error.rs b/capstone-rs/src/error.rs index 3ff083ab..35ba24e5 100644 --- a/capstone-rs/src/error.rs +++ b/capstone-rs/src/error.rs @@ -72,9 +72,7 @@ capstone_error_def!( => UnsupportedX86Masm = CS_ERR_X86_MASM; ); -// Required until https://github.com/rust-lang/rust/issues/103765 is resolved -#[cfg(feature = "std")] -impl std::error::Error for Error {} +impl core::error::Error for Error {} pub type CsResult = result::Result; From 58be1fe56c2608215e1e3b63d4620089a4012951 Mon Sep 17 00:00:00 2001 From: Jiajie Chen Date: Mon, 22 Sep 2025 10:53:46 +0800 Subject: [PATCH 2/3] rs: bump MSRV to 1.81.0 --- .github/workflows/main.yml | 2 +- CHANGELOG.md | 1 + README.md | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 62ca0a08..1197e827 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -10,7 +10,7 @@ jobs: fail-fast: false matrix: rust: - - version: 1.70.0 # MSRV + - version: 1.81.0 # MSRV env: SKIP_CARGO_UPDATE=1 - version: stable - version: beta diff --git a/CHANGELOG.md b/CHANGELOG.md index dc4b3482..01220942 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed - `InsnDetail::regs_read()`/`InsnDetail::regs_write()` return more of the accessed registers - Bump bundled capstone to 5.0.6 +- Bump minimum Rust version to 1.81.0 ### Fixed - `impl Display for Insn<'_>` now avoids to print trailing space diff --git a/README.md b/README.md index 39e854e0..edf3669f 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ The `Capstone` struct is the main interface to the library. See the [`capstone-sys`](capstone-sys) page for the requirements and supported platforms. -* Minimum Rust Version: `1.70.0` +* Minimum Rust Version: `1.81.0` # Example From b76579e3359f15f219d821501ca3f8c46fa3cffd Mon Sep 17 00:00:00 2001 From: Jiajie Chen Date: Mon, 22 Sep 2025 10:57:38 +0800 Subject: [PATCH 3/3] rs: apply cargo clippy --- capstone-rs/src/arch/mod.rs | 2 +- capstone-rs/src/instruction.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/capstone-rs/src/arch/mod.rs b/capstone-rs/src/arch/mod.rs index e9273381..7ab81e78 100644 --- a/capstone-rs/src/arch/mod.rs +++ b/capstone-rs/src/arch/mod.rs @@ -750,7 +750,7 @@ macro_rules! def_arch_details_struct { $iter_struct impl<'a> $OperandIteratorLife { - fn new(ops: &[$cs_arch_op]) -> $OperandIterator { + fn new(ops: &[$cs_arch_op]) -> $OperandIterator<'_> { $OperandIterator(ops.iter()) } } diff --git a/capstone-rs/src/instruction.rs b/capstone-rs/src/instruction.rs index f65a6751..88fe6341 100644 --- a/capstone-rs/src/instruction.rs +++ b/capstone-rs/src/instruction.rs @@ -472,7 +472,7 @@ impl InsnDetail<'_> { } /// Architecture-specific detail - pub fn arch_detail(&self) -> ArchDetail { + pub fn arch_detail(&self) -> ArchDetail<'_> { macro_rules! def_arch_detail_match { ( $( [ $ARCH:ident, $detail:ident, $insn_detail:ident, $arch:ident, $feature:literal ] )*