From a75aef02e764f079651ec94c7bbcf044156ff602 Mon Sep 17 00:00:00 2001 From: Kevin Reid Date: Thu, 18 Jul 2024 15:46:04 -0700 Subject: [PATCH] Disable wgpu-core documentation as a workaround for #4905. This enables `cargo doc` to succeed in a reasonable amount of time, as long as the reader isn't looking for documentation for `wgpu-core` itself. --- wgpu-core/Cargo.toml | 6 ++++++ wgpu-core/src/lib.rs | 12 ++++++++++++ 2 files changed, 18 insertions(+) diff --git a/wgpu-core/Cargo.toml b/wgpu-core/Cargo.toml index 2e645a54067..e8c48ba0911 100644 --- a/wgpu-core/Cargo.toml +++ b/wgpu-core/Cargo.toml @@ -85,6 +85,12 @@ fragile-send-sync-non-atomic-wasm = [ "wgt/fragile-send-sync-non-atomic-wasm", ] +## Enable full documentation. +## If this feature is not enabled, some items will be undocumented. +## This feature is a workaround for +## to enable projects which do not need `wgpu-core` documentation to still use `cargo doc`. +wgpu-core-doc = [] + #! ### Backends, passed through to wgpu-hal # -------------------------------------------------------------------- diff --git a/wgpu-core/src/lib.rs b/wgpu-core/src/lib.rs index 36105c90e6e..98e87e3726e 100644 --- a/wgpu-core/src/lib.rs +++ b/wgpu-core/src/lib.rs @@ -2,6 +2,18 @@ //! It is designed for integration into browsers, as well as wrapping //! into other language-specific user-friendly libraries. //! +#![cfg_attr( + not(any(not(doc), feature = "wgpu-core-doc")), + doc = "\ +## Documentation hidden + +As a workaround for [an issue in rustdoc](https://github.com/rust-lang/rust/issues/114891), +the documentation for `wgpu-core` is empty unless built with +`cargo doc --features wgpu-core-doc`, which may take a very long time. +" +)] +#![cfg(any(not(doc), feature = "wgpu-core-doc"))] +//! //! ## Feature flags #![doc = document_features::document_features!()] //!