From 7e504bdda573b7c740b43f653b0a145b794c25c8 Mon Sep 17 00:00:00 2001 From: Tony Arcieri Date: Thu, 20 Jun 2024 19:23:35 -0600 Subject: [PATCH 1/2] Restore 1.60 MSRV and fix build Seems some changes I force pushed to #123 didn't wind up getting merged. In that PR, I noted that `pub const fn new` was MSRV breaking and got rid of the `const` but that didn't end up in `develop`. I also encountered a build failure on `develop` since the legacy `black_box` function wasn't gated on the `core_hint_black_box` feature and thus clashed with `core::hint::black_box` when it was imported: ``` Compiling subtle v2.6.0 (/Users/tarcieri/src/subtle) error[E0255]: the name `black_box` is defined multiple times --> src/lib.rs:223:1 | 100 | use core::hint::black_box; | --------------------- previous import of the value `black_box` here ... 223 | fn black_box(input: T) -> T { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `black_box` redefined here | = note: `black_box` must be defined only once in the value namespace of this module help: you can use `as` to change the binding name of the import | 100 | use core::hint::black_box as other_black_box; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ warning: unused import: `core::hint::black_box` --> src/lib.rs:100:5 | 100 | use core::hint::black_box; | ^^^^^^^^^^^^^^^^^^^^^ | = note: `#[warn(unused_imports)]` on by default ``` This is a breaking change since we shipped a `const fn` for `BlackBox::new` already, so I'd suggest releasing this as 2.6.1 and yanking 2.6.0 for being unintentionally MSRV breaking. --- src/lib.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index b6e42c4..9fc143b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -219,6 +219,7 @@ impl Not for Choice { /// Note: Rust's notion of "volatile" is subject to change over time. While this /// code may break in a non-destructive way in the future, “constant-time” code /// is a continually moving target, and this is better than doing nothing. +#[cfg(not(feature = "core_hint_black_box"))] #[inline(never)] fn black_box(input: T) -> T { unsafe { @@ -996,7 +997,7 @@ impl BlackBox { /// Constructs a new instance of `BlackBox` which will wrap the specified value. /// /// All access to the inner value will be mediated by a `black_box` optimization barrier. - pub const fn new(value: T) -> Self { + pub fn new(value: T) -> Self { Self(value) } From 1fa4054c8dc6310cbd08e9c623907d5af4ba8686 Mon Sep 17 00:00:00 2001 From: Tony Arcieri Date: Thu, 20 Jun 2024 19:49:45 -0600 Subject: [PATCH 2/2] CI: use 1.60 as the MSRV --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c5fe9e4..7c1616a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -12,7 +12,7 @@ jobs: - stable - beta - nightly - - 1.41.0 + - 1.60.0 steps: - name: checkout uses: actions/checkout@v2