Skip to content

Commit 7e504bd

Browse files
committed
Restore 1.60 MSRV and fix build
Seems some changes I force pushed to dalek-cryptography#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<T: Copy>(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.
1 parent 6dcd695 commit 7e504bd

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,7 @@ impl Not for Choice {
219219
/// Note: Rust's notion of "volatile" is subject to change over time. While this
220220
/// code may break in a non-destructive way in the future, “constant-time” code
221221
/// is a continually moving target, and this is better than doing nothing.
222+
#[cfg(not(feature = "core_hint_black_box"))]
222223
#[inline(never)]
223224
fn black_box<T: Copy>(input: T) -> T {
224225
unsafe {
@@ -996,7 +997,7 @@ impl<T: Copy> BlackBox<T> {
996997
/// Constructs a new instance of `BlackBox` which will wrap the specified value.
997998
///
998999
/// All access to the inner value will be mediated by a `black_box` optimization barrier.
999-
pub const fn new(value: T) -> Self {
1000+
pub fn new(value: T) -> Self {
10001001
Self(value)
10011002
}
10021003

0 commit comments

Comments
 (0)