From 9670e9e6b9b5b2fb5d6405539909db198a5281f4 Mon Sep 17 00:00:00 2001 From: Connor Fitzgerald Date: Wed, 21 Dec 2022 13:17:05 -0500 Subject: [PATCH] Make sure all doctests and tests in wgpu-types run --- .github/workflows/ci.yml | 2 +- Cargo.toml | 2 +- wgpu-core/src/track/mod.rs | 2 +- wgpu-types/Cargo.toml | 1 + wgpu-types/src/lib.rs | 6 +++--- 5 files changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b4a6f86548..48f20600e2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -336,7 +336,7 @@ jobs: run: | set -e - cargo test --doc + cargo test --doc -p wgpu -p wgpu-core -p wgpu-hal -p wgpu-types fmt: name: Format diff --git a/Cargo.toml b/Cargo.toml index 2874adc505..bf4231ddec 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,7 +13,7 @@ members = [ "run-wasm" ] exclude = [] -default-members = ["wgpu", "wgpu-hal", "wgpu-info"] +default-members = ["wgpu", "wgpu-hal", "wgpu-info", "wgpu-types"] [workspace.package] edition = "2021" diff --git a/wgpu-core/src/track/mod.rs b/wgpu-core/src/track/mod.rs index 4fdb64850c..c5bfa68ebb 100644 --- a/wgpu-core/src/track/mod.rs +++ b/wgpu-core/src/track/mod.rs @@ -81,7 +81,7 @@ This allows us to compose the operations to form the various kinds of tracker me that need to happen in the codebase. For each resource in the given merger, the following operation applies: -``` +```text UsageScope <- Resource = insert(scope, usage) OR merge(scope, usage) UsageScope <- UsageScope = insert(scope, scope) OR merge(scope, scope) CommandBuffer <- UsageScope = insert(buffer.start, buffer.end, scope) diff --git a/wgpu-types/Cargo.toml b/wgpu-types/Cargo.toml index c6b1ed6aa9..4ecef74271 100644 --- a/wgpu-types/Cargo.toml +++ b/wgpu-types/Cargo.toml @@ -25,4 +25,5 @@ bitflags = "1" serde = { version = "1", features = ["serde_derive"], optional = true } [dev-dependencies] +serde = { version = "1", features = ["serde_derive"] } serde_json = "1.0.85" diff --git a/wgpu-types/src/lib.rs b/wgpu-types/src/lib.rs index 3cb9bbc858..f2570f5fb0 100644 --- a/wgpu-types/src/lib.rs +++ b/wgpu-types/src/lib.rs @@ -9,7 +9,7 @@ )] #![warn(missing_docs, unsafe_op_in_unsafe_fn)] -#[cfg(feature = "serde")] +#[cfg(any(feature = "serde", test))] use serde::{Deserialize, Serialize}; use std::hash::{Hash, Hasher}; use std::{num::NonZeroU32, ops::Range}; @@ -2103,7 +2103,7 @@ pub enum TextureFormat { }, } -#[cfg(feature = "serde")] +#[cfg(any(feature = "serde", test))] impl<'de> Deserialize<'de> for TextureFormat { fn deserialize(deserializer: D) -> Result where @@ -2239,7 +2239,7 @@ impl<'de> Deserialize<'de> for TextureFormat { } } -#[cfg(feature = "serde")] +#[cfg(any(feature = "serde", test))] impl Serialize for TextureFormat { fn serialize(&self, serializer: S) -> Result where