From ec131ca95c7525040cf6708a139706cd8f4e30b0 Mon Sep 17 00:00:00 2001 From: Ashley Hauck Date: Fri, 23 Apr 2021 10:12:02 +0200 Subject: [PATCH] CI check that docs are able to be built without warnings (#601) * CI check that docs are able to be built without warnings --- .github/workflows/ci.yaml | 2 + crates/spirv-std/src/arch/barrier.rs | 7 ++-- crates/spirv-std/src/arch/derivative.rs | 56 ++++++++++++------------- crates/spirv-std/src/ray_tracing.rs | 4 +- 4 files changed, 33 insertions(+), 36 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 68c6d2203e..be98878981 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -100,6 +100,8 @@ jobs: run: cargo fmt --all -- --check - name: Rustfmt tests run: rustfmt --check tests/ui/**/*.rs + - name: Check docs are valid + run: RUSTDOCFLAGS=-Dwarnings cargo doc - name: Clippy run: .github/workflows/clippy.sh diff --git a/crates/spirv-std/src/arch/barrier.rs b/crates/spirv-std/src/arch/barrier.rs index df255fab96..d93fd67373 100644 --- a/crates/spirv-std/src/arch/barrier.rs +++ b/crates/spirv-std/src/arch/barrier.rs @@ -23,10 +23,9 @@ use crate::memory::{Scope, Semantics}; /// no such restriction starting with version 1.3. /// /// If used with the `TessellationControl` execution model, it also implicitly -/// synchronizes the [`crate::storage_class::Output`] Storage Class: Writes to -/// `Output` variables performed by any invocation executed prior to a -/// [`control_barrier`] are visible to any other invocation proceeding beyond -/// that [`control_barrier`]. +/// synchronizes the `output` storage class: Writes to `output` variables +/// performed by any invocation executed prior to a [`control_barrier`] are +/// visible to any other invocation proceeding beyond that [`control_barrier`]. #[spirv_std_macros::gpu_only] #[doc(alias = "OpControlBarrier")] #[inline] diff --git a/crates/spirv-std/src/arch/derivative.rs b/crates/spirv-std/src/arch/derivative.rs index 0167e5ef61..6dede6bb5c 100644 --- a/crates/spirv-std/src/arch/derivative.rs +++ b/crates/spirv-std/src/arch/derivative.rs @@ -1,5 +1,3 @@ -//! The [`Derivative`] trait for getting derivatives and handling derivative -//! operations in SPIR-V. use crate::float::Float; #[cfg(target_arch = "spirv")] @@ -28,18 +26,17 @@ macro_rules! deriv_fn { }; } -/// Returns the partial derivative of `Self` with respect to the window's -/// X coordinate. Returns the same result as either -/// [`Self::ddx_fine`] or [`Self::ddx_coarse`], selection of which one is -/// dependent on external factors. +/// Returns the partial derivative of `component` with respect to the window's X +/// coordinate. Returns the same result as either [`ddx_fine`] or +/// [`ddx_coarse`], selection of which one is dependent on external factors. #[spirv_std_macros::vectorized] #[spirv_std_macros::gpu_only] pub fn ddx(component: F) -> F { deriv_fn!(component, OpDPdx, false) } -/// Returns the partial derivative of `Self` with respect to the window's -/// X coordinate. Uses local differencing based on the value of `Self` for +/// Returns the partial derivative of `component` with respect to the window's X +/// coordinate. Uses local differencing based on the value of `component` for /// the current fragment and its immediate neighbor(s). #[spirv_std_macros::vectorized] #[spirv_std_macros::gpu_only] @@ -47,30 +44,29 @@ pub fn ddx_fine(component: F) -> F { deriv_fn!(component, OpDPdxFine, true) } -/// Returns the partial derivative of `Self` with respect to the window's -/// X coordinate. Uses local differencing based on the value of `Self` for +/// Returns the partial derivative of `component` with respect to the window's X +/// coordinate. Uses local differencing based on the value of `component` for /// the current fragment’s neighbors, and possibly, but not necessarily, -/// includes the value of `Self` for the current fragment. That is, over a -/// given area, the implementation can compute X derivatives in fewer -/// unique locations than would be allowed by [`Self::ddx_fine`]. +/// includes the value of `component` for the current fragment. That is, over a +/// given area, the implementation can compute X derivatives in fewer unique +/// locations than would be allowed by [`ddx_fine`]. #[spirv_std_macros::vectorized] #[spirv_std_macros::gpu_only] pub fn ddx_coarse(component: F) -> F { deriv_fn!(component, OpDPdxCoarse, true) } -/// Returns the partial derivative of `Self` with respect to the window's -/// Y coordinate. Returns the same result as either [`Self::ddy_fine`] or -/// [`Self::ddy_coarse`], selection of which one is dependent on -/// external factors. +/// Returns the partial derivative of `component` with respect to the window's Y +/// coordinate. Returns the same result as either [`ddy_fine`] or +/// [`ddy_coarse`], selection of which one is dependent on external factors. #[spirv_std_macros::vectorized] #[spirv_std_macros::gpu_only] pub fn ddy(component: F) -> F { deriv_fn!(component, OpDPdy, false) } -/// Returns the partial derivative of `Self` with respect to the window's -/// Y coordinate. Uses local differencing based on the value of `Self` for +/// Returns the partial derivative of `component` with respect to the window's Y +/// coordinate. Uses local differencing based on the value of `component` for /// the current fragment and its immediate neighbor(s). #[spirv_std_macros::vectorized] #[spirv_std_macros::gpu_only] @@ -78,36 +74,36 @@ pub fn ddy_fine(component: F) -> F { deriv_fn!(component, OpDPdyFine, true) } -/// Returns the partial derivative of `Self` with respect to the window's -/// Y coordinate. Uses local differencing based on the value of `Self` for +/// Returns the partial derivative of `component` with respect to the window's Y +/// coordinate. Uses local differencing based on the value of `component` for /// the current fragment’s neighbors, and possibly, but not necessarily, -/// includes the value of `Self` for the current fragment. That is, over a -/// given area, the implementation can compute Y derivatives in fewer -/// unique locations than would be allowed by [`Derivative::ddy_fine`]. +/// includes the value of `component` for the current fragment. That is, over a +/// given area, the implementation can compute Y derivatives in fewer unique +/// locations than would be allowed by [`ddy_fine`]. #[spirv_std_macros::vectorized] #[spirv_std_macros::gpu_only] pub fn ddy_coarse(component: F) -> F { deriv_fn!(component, OpDPdyCoarse, true) } -/// Returns the sum of the absolute values of [`Self::ddx`] and -/// [`Self::ddy`] as a single operation. +/// Returns the sum of the absolute values of [`ddx`] and [`ddy`] as a single +/// operation. #[spirv_std_macros::vectorized] #[spirv_std_macros::gpu_only] pub fn fwidth(component: F) -> F { deriv_fn!(component, OpFwidth, false) } -/// Returns the sum of the absolute values of [`Self::ddx_fine`] and -/// [`Self::ddy_fine`] as a single operation. +/// Returns the sum of the absolute values of [`ddx_fine`] and [`ddy_fine`] as a +/// single operation. #[spirv_std_macros::vectorized] #[spirv_std_macros::gpu_only] pub fn fwidth_fine(component: F) -> F { deriv_fn!(component, OpFwidthFine, true) } -/// Returns the sum of the absolute values of [`Self::ddx_coarse`] and -/// [`Self::ddy_coarse`] as a single operation. +/// Returns the sum of the absolute values of [`ddx_coarse`] and [`ddy_coarse`] +/// as a single operation. #[spirv_std_macros::vectorized] #[spirv_std_macros::gpu_only] pub fn fwidth_coarse(component: F) -> F { diff --git a/crates/spirv-std/src/ray_tracing.rs b/crates/spirv-std/src/ray_tracing.rs index 9ae62a2e1e..14ce58efaa 100644 --- a/crates/spirv-std/src/ray_tracing.rs +++ b/crates/spirv-std/src/ray_tracing.rs @@ -10,7 +10,7 @@ pub struct AccelerationStructure { } impl AccelerationStructure { - /// Converts a 64-bit integer into an [`AccelerationStructureKHR`]. + /// Converts a 64-bit integer into an [`AccelerationStructure`]. /// # Safety /// The 64-bit integer must point to a valid acceleration structure. #[spirv_std_macros::gpu_only] @@ -31,7 +31,7 @@ impl AccelerationStructure { loop {} } - /// Converts a vector of two 32 bit integers into an [`AccelerationStructureKHR`]. + /// Converts a vector of two 32 bit integers into an [`AccelerationStructure`]. /// # Safety /// The combination must point to a valid acceleration structure. #[spirv_std_macros::gpu_only]