about summary refs log tree commit diff
diff options
context:
space:
mode:
authorDaniel Paoliello <danpao@microsoft.com>2024-03-22 16:08:24 -0700
committerGitHub <noreply@github.com>2024-03-22 16:08:24 -0700
commitcff979eec1ac0473fc4960ee6cde462c6aeda824 (patch)
tree9b4695ff9d7ccc20cb2f7b8c52c060d044a1c61b
parent53de3f08061bfeb4a96ade3587aee366cd13e065 (diff)
Validate generating docs (rust-lang/portable-simd#407)
- Generate docs with warnings disabled.
- Instruct doctest to add `#![deny(warnings)]` to all tests.
-rw-r--r--.github/workflows/ci.yml5
-rw-r--r--crates/core_simd/src/lib.rs1
-rw-r--r--crates/core_simd/src/vector.rs6
3 files changed, 9 insertions, 3 deletions
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 90543044ea8..b292be2d6f9 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -141,6 +141,11 @@ jobs:
       - name: Test (release)
         run: cargo test --verbose --target=${{ matrix.target }} --release
 
+      - name: Generate docs
+        run: cargo doc --verbose --target=${{ matrix.target }}
+        env:
+          RUSTDOCFLAGS: -Dwarnings
+
   wasm-tests:
     name: "wasm (firefox, ${{ matrix.name }})"
     runs-on: ubuntu-latest
diff --git a/crates/core_simd/src/lib.rs b/crates/core_simd/src/lib.rs
index a2e40e81105..7a161b7e01d 100644
--- a/crates/core_simd/src/lib.rs
+++ b/crates/core_simd/src/lib.rs
@@ -40,6 +40,7 @@
 )]
 #![warn(missing_docs, clippy::missing_inline_in_public_items)] // basically all items, really
 #![deny(unsafe_op_in_unsafe_fn, clippy::undocumented_unsafe_blocks)]
+#![doc(test(attr(deny(warnings))))]
 #![allow(internal_features)]
 #![unstable(feature = "portable_simd", issue = "86656")]
 //! Portable SIMD module.
diff --git a/crates/core_simd/src/vector.rs b/crates/core_simd/src/vector.rs
index 2d8b48a9a8f..6c8205b112c 100644
--- a/crates/core_simd/src/vector.rs
+++ b/crates/core_simd/src/vector.rs
@@ -325,7 +325,7 @@ where
     /// # #![feature(portable_simd)]
     /// # #[cfg(feature = "as_crate")] use core_simd::simd;
     /// # #[cfg(not(feature = "as_crate"))] use core::simd;
-    /// # use simd::{Simd, Mask};
+    /// # use simd::Simd;
     /// let vec: Vec<i32> = vec![10, 11];
     ///
     /// let result = Simd::<i32, 4>::load_or_default(&vec);
@@ -348,7 +348,7 @@ where
     /// # #![feature(portable_simd)]
     /// # #[cfg(feature = "as_crate")] use core_simd::simd;
     /// # #[cfg(not(feature = "as_crate"))] use core::simd;
-    /// # use simd::{Simd, Mask};
+    /// # use simd::Simd;
     /// let vec: Vec<i32> = vec![10, 11];
     /// let or = Simd::from_array([-5, -4, -3, -2]);
     ///
@@ -695,7 +695,7 @@ where
     ///
     /// # Safety
     ///
-    /// Memory addresses for element are calculated [`core::ptr::wrapping_offset`] and
+    /// Memory addresses for element are calculated [`pointer::wrapping_offset`] and
     /// each enabled element must satisfy the same conditions as [`core::ptr::write`].
     #[inline]
     pub unsafe fn store_select_ptr(self, ptr: *mut T, enable: Mask<<T as SimdElement>::Mask, N>) {