From 8444db4fb2887c86dc87533fc20b85a0a5da1233 Mon Sep 17 00:00:00 2001 From: Marijn Suijten Date: Sun, 14 Mar 2021 11:31:17 +0100 Subject: [PATCH] ci: Test docs in addition to `cargo t --all-targets` (#392) * ci: Test docs in addition to `cargo t --all-targets` Unfortunately docs are not explicitly (build-)tested as part of `--all-targets` allowing broken code to slip in as shown by #390. Also remove the `rust` listing type which is the default, leaving only `no_run` (until the CI has a loadable Vulkan library). * ash: Fix errors and warnings in (now tested) documentation comments --- .github/workflows/ci.yml | 8 +++++++- ash/src/entry.rs | 6 +++--- ash/src/entry_libloading.rs | 6 +++--- ash/src/lib.rs | 4 ++-- 4 files changed, 15 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b56767a..33bde8e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -53,10 +53,16 @@ jobs: profile: minimal toolchain: stable override: true - - uses: actions-rs/cargo@v1 + - name: Test all targets + uses: actions-rs/cargo@v1 with: command: test args: --workspace --all-targets + - name: Test docs + uses: actions-rs/cargo@v1 + with: + command: test + args: --workspace --doc fmt: name: Rustfmt diff --git a/ash/src/entry.rs b/ash/src/entry.rs index 3a4d689..558df95 100644 --- a/ash/src/entry.rs +++ b/ash/src/entry.rs @@ -191,10 +191,10 @@ impl EntryCustom { } #[doc = ""] - /// ```rust,no_run + /// ```no_run /// # use ash::{Entry, vk}; - /// # fn main() -> Result<(), Box> { - /// let entry = Entry::new()?; + /// # fn main() -> Result<(), Box> { + /// let entry = unsafe { Entry::new() }?; /// match entry.try_enumerate_instance_version()? { /// // Vulkan 1.1+ /// Some(version) => { diff --git a/ash/src/entry_libloading.rs b/ash/src/entry_libloading.rs index 4ff55f3..ab286eb 100644 --- a/ash/src/entry_libloading.rs +++ b/ash/src/entry_libloading.rs @@ -46,10 +46,10 @@ impl EntryCustom> { /// `dlopen`ing native libraries is inherently unsafe. The safety guidelines /// for [`Library::new`] and [`Library::get`] apply here. /// - /// ```rust,no_run + /// ```no_run /// use ash::{vk, Entry, version::EntryV1_0}; - /// # fn main() -> Result<(), Box> { - /// let entry = Entry::new()?; + /// # fn main() -> Result<(), Box> { + /// let entry = unsafe { Entry::new() }?; /// let app_info = vk::ApplicationInfo { /// api_version: vk::make_version(1, 0, 0), /// ..Default::default() diff --git a/ash/src/lib.rs b/ash/src/lib.rs index 11374f5..4f3f596 100644 --- a/ash/src/lib.rs +++ b/ash/src/lib.rs @@ -5,10 +5,10 @@ //! //! ## Examples //! -//! ```rust,no_run +//! ```no_run //! use ash::{vk, Entry, version::EntryV1_0}; //! # fn main() -> Result<(), Box> { -//! let entry = Entry::new()?; +//! let entry = unsafe { Entry::new() }?; //! let app_info = vk::ApplicationInfo { //! api_version: vk::make_version(1, 0, 0), //! ..Default::default()