Skip to content

Commit

Permalink
Fix simd_backend + --no-default-features
Browse files Browse the repository at this point in the history
...and one other `alloc` cleanup.

`simd_backend` requires `alloc` and so this combination previously
caused a compile error.

Also one additional test that works with an `alloc`-only profile wasn't
enabled, causing a warning in this case.

Finally, changes CI to test this configuration.
  • Loading branch information
tarcieri committed Nov 14, 2022
1 parent 7d27510 commit e5d6359
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,4 @@ alloc = ["zeroize/alloc"]
# fiat-crypto backend with formally-verified field arithmetic
fiat_backend = ["fiat-crypto"]
# The SIMD backend uses parallel formulas, using either AVX2 or AVX512-IFMA.
simd_backend = ["nightly", "packed_simd"]
simd_backend = ["alloc", "nightly", "packed_simd"]
3 changes: 2 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
// External dependencies:
//------------------------------------------------------------------------

#[cfg(all(feature = "alloc", not(feature = "std")))]
#[cfg(feature = "alloc")]
#[allow(unused_imports)]
#[macro_use]
extern crate alloc;

Expand Down
4 changes: 2 additions & 2 deletions src/montgomery.rs
Original file line number Diff line number Diff line change
Expand Up @@ -470,9 +470,9 @@ mod test {
];

#[test]
#[cfg(feature = "std")] // Vec
#[cfg(feature = "alloc")] // Vec
fn montgomery_elligator_correct() {
let bytes: std::vec::Vec<u8> = (0u8..32u8).collect();
let bytes: alloc::vec::Vec<u8> = (0u8..32u8).collect();
let bits_in: [u8; 32] = (&bytes[..]).try_into().expect("Range invariant broken");

let fe = FieldElement::from_bytes(&bits_in);
Expand Down

0 comments on commit e5d6359

Please sign in to comment.