From cae0c71f8c685c1ea00913d502a2352b94efd4a4 Mon Sep 17 00:00:00 2001 From: Tony Arcieri Date: Mon, 29 Dec 2025 14:10:17 -0700 Subject: [PATCH] ctutils: remove `Choice::new` It had weird semantics: panicking in debug mode if given a `u8` other than `0` or `1`. Instead `Choice::from_u8_lsb` provides an equivalent constructor which never panicks or incorrectly initializes a `Choice`. --- Cargo.lock | 2 +- ctutils/Cargo.toml | 2 +- ctutils/src/choice.rs | 7 ------- 3 files changed, 2 insertions(+), 9 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index acbb5fee..e24b061f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -108,7 +108,7 @@ dependencies = [ [[package]] name = "ctutils" -version = "0.2.3" +version = "0.3.0-pre" dependencies = [ "cmov", "subtle", diff --git a/ctutils/Cargo.toml b/ctutils/Cargo.toml index fe08d4e0..e0a20755 100644 --- a/ctutils/Cargo.toml +++ b/ctutils/Cargo.toml @@ -5,7 +5,7 @@ Constant-time utility library with selection and equality testing support target applications. Supports `const fn` where appropriate. Built on the `cmov` crate which provides architecture-specific predication intrinsics. Heavily inspired by the `subtle` crate. """ -version = "0.2.3" +version = "0.3.0-pre" authors = ["RustCrypto Developers"] license = "Apache-2.0 OR MIT" homepage = "https://github.com/RustCrypto/utils/tree/master/ctselect" diff --git a/ctutils/src/choice.rs b/ctutils/src/choice.rs index b6dd08c1..75e722ac 100644 --- a/ctutils/src/choice.rs +++ b/ctutils/src/choice.rs @@ -45,13 +45,6 @@ impl Choice { /// Equivalent of [`true`]. pub const TRUE: Self = Self(1); - /// DEPRECATED: legacy alias for [`Choice::from_u8_lsb`]. - #[deprecated(since = "0.2.3", note = "use `Choice::from_u8_lsb` instead")] - #[inline] - pub const fn new(value: u8) -> Self { - Self::from_u8_lsb(value) - } - /// Convert `Choice` into a `bool`. /// ///