From 3b71630d9fd6823ca841a1e500bac2a41640ba8b Mon Sep 17 00:00:00 2001 From: Michael Rosenberg Date: Thu, 2 Feb 2023 04:06:14 -0500 Subject: [PATCH] Fix docsrs build (#505) * Add docsrs build to CI * Put cfg flags in both RUSTFLAGS and RUSTDOCFLAGS --- .github/workflows/rust.yml | 9 +++++++++ Makefile | 9 +++++++-- src/backend/vector/mod.rs | 5 +---- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index a495070..d3ea867 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -69,6 +69,15 @@ jobs: RUSTFLAGS: '--cfg curve25519_dalek_backend="simd" -C target_feature=+avx512ifma' run: cargo build --target x86_64-unknown-linux-gnu + build-docs: + name: Build docs + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: dtolnay/rust-toolchain@nightly + - run: make doc + - run: make doc-internal + cross: strategy: matrix: diff --git a/Makefile b/Makefile index 2eafcaa..b263cf7 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,12 @@ FEATURES := serde rand_core digest +export RUSTFLAGS := --cfg=curve25519_dalek_backend="simd" +export RUSTDOCFLAGS := \ + --cfg docsrs \ + --html-in-header docs/assets/rustdoc-include-katex-header.html + doc: - cargo +nightly rustdoc --features "$(FEATURES)" -- --html-in-header docs/assets/rustdoc-include-katex-header.html --cfg docsrs --cfg=curve25519_dalek_backend=\"simd\" + cargo +nightly rustdoc --features "$(FEATURES)" doc-internal: - cargo +nightly rustdoc --features "$(FEATURES)" -- --html-in-header docs/assets/rustdoc-include-katex-header.html --document-private-items --cfg docsrs --cfg=curve25519_dalek_backend=\"simd\" + cargo +nightly rustdoc --features "$(FEATURES)" -- --document-private-items diff --git a/src/backend/vector/mod.rs b/src/backend/vector/mod.rs index f81648e..b05cffb 100644 --- a/src/backend/vector/mod.rs +++ b/src/backend/vector/mod.rs @@ -50,8 +50,5 @@ pub mod scalar_mul; ))] pub(crate) use self::avx2::constants::BASEPOINT_ODD_LOOKUP_TABLE; -#[cfg(any( - all(target_feature = "avx512ifma", feature = "precomputed-tables"), - all(docsrs, target_arch = "x86_64") -))] +#[cfg(all(target_feature = "avx512ifma", feature = "precomputed-tables"))] pub(crate) use self::ifma::constants::BASEPOINT_ODD_LOOKUP_TABLE;