Cleanup: enabled doc_auto_cfg and doc_cfg_hide

This commit is contained in:
Michael Rosenberg 2022-11-26 06:34:48 -05:00
parent 289cc52fef
commit 791ba170b1
7 changed files with 3 additions and 62 deletions

View file

@ -9,7 +9,7 @@
// - isis agora lovecruft <isis@patternsinthevoid.net> // - isis agora lovecruft <isis@patternsinthevoid.net>
// - Henry de Valence <hdevalence@hdevalence.ca> // - Henry de Valence <hdevalence@hdevalence.ca>
//! INTERNALS: Pluggable implementations for different architectures. //! **INTERNALS:** Pluggable implementations for different architectures.
//! //!
//! The backend code is split into two parts: a serial backend, //! The backend code is split into two parts: a serial backend,
//! and a vector backend. //! and a vector backend.
@ -37,5 +37,4 @@
pub mod serial; pub mod serial;
#[cfg(any(feature = "simd_backend", docsrs))] #[cfg(any(feature = "simd_backend", docsrs))]
#[cfg_attr(docsrs, doc(cfg(feature = "simd_backend")))]
pub mod vector; pub mod vector;

View file

@ -23,25 +23,15 @@ use cfg_if::cfg_if;
cfg_if! { cfg_if! {
if #[cfg(feature = "fiat_backend")] { if #[cfg(feature = "fiat_backend")] {
#[cfg(not(target_pointer_width = "64"))] #[cfg(not(target_pointer_width = "64"))]
#[cfg_attr(
docsrs,
doc(cfg(all(feature = "fiat_backend", not(target_pointer_width = "64"))))
)]
pub mod fiat_u32; pub mod fiat_u32;
#[cfg(target_pointer_width = "64")] #[cfg(target_pointer_width = "64")]
#[cfg_attr(
docsrs,
doc(cfg(all(feature = "fiat_backend", target_pointer_width = "64")))
)]
pub mod fiat_u64; pub mod fiat_u64;
} else { } else {
#[cfg(not(target_pointer_width = "64"))] #[cfg(not(target_pointer_width = "64"))]
#[cfg_attr(docsrs, doc(cfg(not(target_pointer_width = "64"))))]
pub mod u32; pub mod u32;
#[cfg(target_pointer_width = "64")] #[cfg(target_pointer_width = "64")]
#[cfg_attr(docsrs, doc(cfg(target_pointer_width = "64")))]
pub mod u64; pub mod u64;
} }
} }
@ -52,11 +42,4 @@ pub mod curve_models;
feature = "simd_backend", feature = "simd_backend",
any(target_feature = "avx2", target_feature = "avx512ifma") any(target_feature = "avx2", target_feature = "avx512ifma")
)))] )))]
#[cfg_attr(
docsrs,
doc(cfg(not(all(
feature = "simd_backend",
any(target_feature = "avx2", target_feature = "avx512ifma")
))))
)]
pub mod scalar_mul; pub mod scalar_mul;

View file

@ -18,36 +18,22 @@ compile_error!("simd_backend selected without target_feature=+avx2 or +avx512ifm
all(target_feature = "avx2", not(target_feature = "avx512ifma")), all(target_feature = "avx2", not(target_feature = "avx512ifma")),
docsrs docsrs
))] ))]
#[cfg_attr(
docsrs,
doc(cfg(all(target_feature = "avx2", not(target_feature = "avx512ifma")),))
)]
pub mod avx2; pub mod avx2;
#[cfg(any( #[cfg(any(
all(target_feature = "avx2", not(target_feature = "avx512ifma")), all(target_feature = "avx2", not(target_feature = "avx512ifma")),
docsrs docsrs
))] ))]
#[cfg_attr(
docsrs,
doc(cfg(all(target_feature = "avx2", not(target_feature = "avx512ifma")),))
)]
pub(crate) use self::avx2::{ pub(crate) use self::avx2::{
constants::BASEPOINT_ODD_LOOKUP_TABLE, edwards::CachedPoint, edwards::ExtendedPoint, constants::BASEPOINT_ODD_LOOKUP_TABLE, edwards::CachedPoint, edwards::ExtendedPoint,
}; };
#[cfg(any(target_feature = "avx512ifma", docsrs))] #[cfg(any(target_feature = "avx512ifma", docsrs))]
#[cfg_attr(docsrs, doc(cfg(target_feature = "avx512ifma")))]
pub mod ifma; pub mod ifma;
#[cfg(target_feature = "avx512ifma")] #[cfg(target_feature = "avx512ifma")]
#[cfg_attr(docsrs, doc(cfg(target_feature = "avx512ifma")))]
pub(crate) use self::ifma::{ pub(crate) use self::ifma::{
constants::BASEPOINT_ODD_LOOKUP_TABLE, edwards::CachedPoint, edwards::ExtendedPoint, constants::BASEPOINT_ODD_LOOKUP_TABLE, edwards::CachedPoint, edwards::ExtendedPoint,
}; };
#[cfg(any(target_feature = "avx2", target_feature = "avx512ifma", docsrs))] #[cfg(any(target_feature = "avx2", target_feature = "avx512ifma", docsrs))]
#[cfg_attr(
docsrs,
doc(cfg(any(target_feature = "avx2", target_feature = "avx512ifma")))
)]
#[allow(missing_docs)] #[allow(missing_docs)]
pub mod scalar_mul; pub mod scalar_mul;

View file

@ -223,7 +223,6 @@ use serde::de::Visitor;
use serde::{self, Deserialize, Deserializer, Serialize, Serializer}; use serde::{self, Deserialize, Deserializer, Serialize, Serializer};
#[cfg(feature = "serde")] #[cfg(feature = "serde")]
#[cfg_attr(docsrs, doc(cfg(feature = "serde")))]
impl Serialize for EdwardsPoint { impl Serialize for EdwardsPoint {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where where
@ -239,7 +238,6 @@ impl Serialize for EdwardsPoint {
} }
#[cfg(feature = "serde")] #[cfg(feature = "serde")]
#[cfg_attr(docsrs, doc(cfg(feature = "serde")))]
impl Serialize for CompressedEdwardsY { impl Serialize for CompressedEdwardsY {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where where
@ -255,7 +253,6 @@ impl Serialize for CompressedEdwardsY {
} }
#[cfg(feature = "serde")] #[cfg(feature = "serde")]
#[cfg_attr(docsrs, doc(cfg(feature = "serde")))]
impl<'de> Deserialize<'de> for EdwardsPoint { impl<'de> Deserialize<'de> for EdwardsPoint {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where where
@ -291,7 +288,6 @@ impl<'de> Deserialize<'de> for EdwardsPoint {
} }
#[cfg(feature = "serde")] #[cfg(feature = "serde")]
#[cfg_attr(docsrs, doc(cfg(feature = "serde")))]
impl<'de> Deserialize<'de> for CompressedEdwardsY { impl<'de> Deserialize<'de> for CompressedEdwardsY {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where where

View file

@ -38,16 +38,8 @@ use crate::constants;
cfg_if! { cfg_if! {
if #[cfg(feature = "fiat_backend")] { if #[cfg(feature = "fiat_backend")] {
#[cfg(not(target_pointer_width = "64"))] #[cfg(not(target_pointer_width = "64"))]
#[cfg_attr(
docsrs,
doc(cfg(all(feature = "fiat_backend", not(target_pointer_width = "64"))))
)]
pub use backend::serial::fiat_u32::field::*; pub use backend::serial::fiat_u32::field::*;
#[cfg(target_pointer_width = "64")] #[cfg(target_pointer_width = "64")]
#[cfg_attr(
docsrs,
doc(cfg(all(feature = "fiat_backend", target_pointer_width = "64")))
)]
pub use backend::serial::fiat_u64::field::*; pub use backend::serial::fiat_u64::field::*;
/// A `FieldElement` represents an element of the field /// A `FieldElement` represents an element of the field
@ -58,10 +50,6 @@ cfg_if! {
/// ///
/// Using formally-verified field arithmetic from fiat-crypto. /// Using formally-verified field arithmetic from fiat-crypto.
#[cfg(not(target_pointer_width = "64"))] #[cfg(not(target_pointer_width = "64"))]
#[cfg_attr(
docsrs,
doc(cfg(all(feature = "fiat_backend", not(target_pointer_width = "64"))))
)]
pub type FieldElement = backend::serial::fiat_u32::field::FieldElement2625; pub type FieldElement = backend::serial::fiat_u32::field::FieldElement2625;
/// A `FieldElement` represents an element of the field /// A `FieldElement` represents an element of the field
@ -72,13 +60,8 @@ cfg_if! {
/// ///
/// Using formally-verified field arithmetic from fiat-crypto. /// Using formally-verified field arithmetic from fiat-crypto.
#[cfg(target_pointer_width = "64")] #[cfg(target_pointer_width = "64")]
#[cfg_attr(
docsrs,
doc(cfg(all(feature = "fiat_backend", target_pointer_width = "64")))
)]
pub type FieldElement = backend::serial::fiat_u64::field::FieldElement51; pub type FieldElement = backend::serial::fiat_u64::field::FieldElement51;
} else if #[cfg(target_pointer_width = "64")] { } else if #[cfg(target_pointer_width = "64")] {
#[cfg_attr(docsrs, doc(cfg(target_pointer_width = "64")))]
pub use crate::backend::serial::u64::field::*; pub use crate::backend::serial::u64::field::*;
/// A `FieldElement` represents an element of the field /// A `FieldElement` represents an element of the field
@ -86,10 +69,8 @@ cfg_if! {
/// ///
/// The `FieldElement` type is an alias for one of the platform-specific /// The `FieldElement` type is an alias for one of the platform-specific
/// implementations. /// implementations.
#[cfg_attr(docsrs, doc(cfg(target_pointer_width = "64")))]
pub type FieldElement = backend::serial::u64::field::FieldElement51; pub type FieldElement = backend::serial::u64::field::FieldElement51;
} else { } else {
#[cfg_attr(docsrs, doc(cfg(not(target_pointer_width = "64"))))]
pub use backend::serial::u32::field::*; pub use backend::serial::u32::field::*;
/// A `FieldElement` represents an element of the field /// A `FieldElement` represents an element of the field
@ -97,7 +78,6 @@ cfg_if! {
/// ///
/// The `FieldElement` type is an alias for one of the platform-specific /// The `FieldElement` type is an alias for one of the platform-specific
/// implementations. /// implementations.
#[cfg_attr(docsrs, doc(cfg(not(target_pointer_width = "64"))))]
pub type FieldElement = backend::serial::u32::field::FieldElement2625; pub type FieldElement = backend::serial::u32::field::FieldElement2625;
} }
} }

View file

@ -10,8 +10,9 @@
// - Henry de Valence <hdevalence@hdevalence.ca> // - Henry de Valence <hdevalence@hdevalence.ca>
#![no_std] #![no_std]
#![cfg_attr(docsrs, feature(doc_cfg))]
#![cfg_attr(feature = "simd_backend", feature(stdsimd))] #![cfg_attr(feature = "simd_backend", feature(stdsimd))]
#![cfg_attr(docsrs, feature(doc_auto_cfg, doc_cfg, doc_cfg_hide))]
#![cfg_attr(docsrs, doc(cfg_hide(docsrs)))]
//------------------------------------------------------------------------ //------------------------------------------------------------------------
// Documentation: // Documentation:
//------------------------------------------------------------------------ //------------------------------------------------------------------------

View file

@ -341,7 +341,6 @@ use serde::de::Visitor;
use serde::{self, Deserialize, Deserializer, Serialize, Serializer}; use serde::{self, Deserialize, Deserializer, Serialize, Serializer};
#[cfg(feature = "serde")] #[cfg(feature = "serde")]
#[cfg_attr(docsrs, doc(cfg(feature = "serde")))]
impl Serialize for RistrettoPoint { impl Serialize for RistrettoPoint {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where where
@ -357,7 +356,6 @@ impl Serialize for RistrettoPoint {
} }
#[cfg(feature = "serde")] #[cfg(feature = "serde")]
#[cfg_attr(docsrs, doc(cfg(feature = "serde")))]
impl Serialize for CompressedRistretto { impl Serialize for CompressedRistretto {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where where
@ -373,7 +371,6 @@ impl Serialize for CompressedRistretto {
} }
#[cfg(feature = "serde")] #[cfg(feature = "serde")]
#[cfg_attr(docsrs, doc(cfg(feature = "serde")))]
impl<'de> Deserialize<'de> for RistrettoPoint { impl<'de> Deserialize<'de> for RistrettoPoint {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where where
@ -409,7 +406,6 @@ impl<'de> Deserialize<'de> for RistrettoPoint {
} }
#[cfg(feature = "serde")] #[cfg(feature = "serde")]
#[cfg_attr(docsrs, doc(cfg(feature = "serde")))]
impl<'de> Deserialize<'de> for CompressedRistretto { impl<'de> Deserialize<'de> for CompressedRistretto {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where where