Fix --no-default-features
test warnings; consolidate CI jobs (#461)
Previously `cargo test --no-default-features` would succeed but with warnings. This commit fixes all of those warnings and tests `--no-default-features` in CI to ensure that in perpetuity.
This commit is contained in:
parent
0b72bb5dc2
commit
1e490bd001
21
.github/workflows/rust.yml
vendored
21
.github/workflows/rust.yml
vendored
@ -8,6 +8,7 @@ on:
|
||||
|
||||
env:
|
||||
CARGO_TERM_COLOR: always
|
||||
RUSTFLAGS: '-D warnings'
|
||||
|
||||
jobs:
|
||||
test:
|
||||
@ -26,8 +27,10 @@ jobs:
|
||||
- uses: dtolnay/rust-toolchain@stable
|
||||
- run: rustup target add ${{ matrix.target }}
|
||||
- run: ${{ matrix.deps }}
|
||||
- run: cargo test --target ${{ matrix.target }} --no-default-features
|
||||
- run: cargo test --target ${{ matrix.target }}
|
||||
- run: cargo test --target ${{ matrix.target }} --features fiat_backend
|
||||
- run: cargo test --target ${{ matrix.target }} --features serde
|
||||
|
||||
build-simd:
|
||||
name: Build simd backend (nightly)
|
||||
@ -43,24 +46,6 @@ jobs:
|
||||
RUSTFLAGS: "-C target_feature=+avx512ifma"
|
||||
run: cargo build --target x86_64-unknown-linux-gnu --features simd_backend
|
||||
|
||||
test-defaults-serde:
|
||||
name: Test default feature selection and serde
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: dtolnay/rust-toolchain@stable
|
||||
- run: cargo test --features "serde"
|
||||
|
||||
test-alloc-u32:
|
||||
name: Test no_std+alloc with u32 backend
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: dtolnay/rust-toolchain@stable
|
||||
- run: rustup target add i686-unknown-linux-gnu
|
||||
- run: sudo apt update && sudo apt install gcc-multilib
|
||||
- run: cargo test --lib --no-default-features --features alloc --target i686-unknown-linux-gnu
|
||||
|
||||
nightly:
|
||||
name: Test nightly compiler
|
||||
runs-on: ubuntu-latest
|
||||
|
@ -482,6 +482,7 @@ mod test {
|
||||
assert_eq!(result, expected.to_montgomery())
|
||||
}
|
||||
|
||||
#[cfg(feature = "alloc")]
|
||||
const ELLIGATOR_CORRECT_OUTPUT: [u8; 32] = [
|
||||
0x5f, 0x35, 0x20, 0x00, 0x1c, 0x6c, 0x99, 0x36, 0xa3, 0x12, 0x06, 0xaf, 0xe7, 0xc7, 0xac,
|
||||
0x22, 0x4e, 0x88, 0x61, 0x61, 0x9b, 0xf9, 0x88, 0x72, 0x44, 0x49, 0x15, 0x89, 0x9d, 0x95,
|
||||
|
@ -179,6 +179,9 @@ use digest::Digest;
|
||||
use crate::constants;
|
||||
use crate::field::FieldElement;
|
||||
|
||||
#[cfg(feature = "alloc")]
|
||||
use cfg_if::cfg_if;
|
||||
|
||||
use subtle::Choice;
|
||||
use subtle::ConditionallyNegatable;
|
||||
use subtle::ConditionallySelectable;
|
||||
@ -196,16 +199,17 @@ use crate::traits::Identity;
|
||||
#[cfg(feature = "alloc")]
|
||||
use crate::traits::{MultiscalarMul, VartimeMultiscalarMul, VartimePrecomputedMultiscalarMul};
|
||||
|
||||
#[cfg(not(all(
|
||||
feature = "simd_backend",
|
||||
any(target_feature = "avx2", target_feature = "avx512ifma")
|
||||
)))]
|
||||
use crate::backend::serial::scalar_mul;
|
||||
#[cfg(all(
|
||||
feature = "simd_backend",
|
||||
any(target_feature = "avx2", target_feature = "avx512ifma")
|
||||
))]
|
||||
use crate::backend::vector::scalar_mul;
|
||||
#[cfg(feature = "alloc")]
|
||||
cfg_if! {
|
||||
if #[cfg(all(
|
||||
feature = "simd_backend",
|
||||
any(target_feature = "avx2", target_feature = "avx512ifma")
|
||||
))] {
|
||||
use crate::backend::vector::scalar_mul;
|
||||
} else {
|
||||
use crate::backend::serial::scalar_mul;
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// Compressed points
|
||||
|
@ -1025,6 +1025,7 @@ impl Scalar {
|
||||
|
||||
/// Returns a size hint indicating how many entries of the return
|
||||
/// value of `to_radix_2w` are nonzero.
|
||||
#[cfg(any(feature = "alloc", test))]
|
||||
pub(crate) fn to_radix_2w_size_hint(w: usize) -> usize {
|
||||
debug_assert!(w >= 4);
|
||||
debug_assert!(w <= 8);
|
||||
|
Loading…
x
Reference in New Issue
Block a user