From 2e260e17381cc55161e8f8d5234134a53cfccbf0 Mon Sep 17 00:00:00 2001 From: mio Date: Fri, 19 Sep 2025 19:40:12 +0800 Subject: [PATCH 1/2] fix --- crates/unicorn-sys/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/unicorn-sys/src/lib.rs b/crates/unicorn-sys/src/lib.rs index 3733f81..ca49816 100644 --- a/crates/unicorn-sys/src/lib.rs +++ b/crates/unicorn-sys/src/lib.rs @@ -94,7 +94,7 @@ impl TryFrom for Mode { if (v & !VALID_MODES) != 0 { return Err(uc_error::MODE); } - Ok(Self(v as u32)) + Ok(Self(v as u32).try_into().map_err(|_| uc_error::MODE)?) } } From 4127235ce37a719af414cbb29e1c5ad4ba1afbd8 Mon Sep 17 00:00:00 2001 From: mio Date: Fri, 19 Sep 2025 19:45:27 +0800 Subject: [PATCH 2/2] inner try_into() --- crates/unicorn-sys/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/unicorn-sys/src/lib.rs b/crates/unicorn-sys/src/lib.rs index ca49816..b1de4a3 100644 --- a/crates/unicorn-sys/src/lib.rs +++ b/crates/unicorn-sys/src/lib.rs @@ -94,7 +94,7 @@ impl TryFrom for Mode { if (v & !VALID_MODES) != 0 { return Err(uc_error::MODE); } - Ok(Self(v as u32).try_into().map_err(|_| uc_error::MODE)?) + Ok(Self(v.try_into().map_err(|_| uc_error::MODE)?)) } }