Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion packages/rs-dash-async/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ tracing = "0.1.41"

[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
tokio = { version = "1.40", features = ["rt", "rt-multi-thread", "time", "net"] }
tokio-util = { version = "0.7.12" }
futures = { version = "0.3.30" }

[dev-dependencies]
tokio = { version = "1.40", features = ["macros", "rt-multi-thread", "sync"] }
tokio = { version = "1.40", features = ["macros", "rt-multi-thread", "sync", "time"] }
11 changes: 11 additions & 0 deletions packages/rs-dash-async/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,18 @@
//!
//! Provides [`block_on`] -- a function that bridges async futures into sync code,
//! handling multiple tokio runtime flavors (no runtime, current-thread, multi-thread).
//!
//! Also provides [`ThreadRegistry`] — a shared lifecycle engine for background
//! OS-thread / tokio-task workers (start, cancel, weight-ordered quiesce +
//! join, orphan reap).
Comment on lines +5 to +8

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail
cargo rustdoc \
  --manifest-path packages/rs-dash-async/Cargo.toml \
  --target wasm32-unknown-unknown -- -D warnings

Repository: dashpay/platform

Length of output: 146


🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

# Inspect the crate docs and the cfg-gated export.
sed -n '1,80p' packages/rs-dash-async/src/lib.rs

echo
echo '---'
rg -n "ThreadRegistry|wasm32|cfg" packages/rs-dash-async/src -S

Repository: dashpay/platform

Length of output: 12483


🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

rustup target list --installed || true

tmpdir="$(mktemp -d)"
cat >"$tmpdir/lib.rs" <<'RS'
//! Docs mention [`Thing`].
//! 
//! Also mentions [`Thing`] in the crate docs.

#[cfg(not(target_arch = "wasm32"))]
pub struct Thing;
RS

rustdoc "$tmpdir/lib.rs" \
  --crate-name probe \
  --target wasm32-unknown-unknown \
  -D warnings \
  --edition=2021 \
  --crate-type lib

Repository: dashpay/platform

Length of output: 248


🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

tmpdir="$(mktemp -d)"
mkdir -p "$tmpdir/src"
cat >"$tmpdir/Cargo.toml" <<'TOML'
[package]
name = "probe"
version = "0.1.0"
edition = "2021"

[lib]
path = "src/lib.rs"
TOML

cat >"$tmpdir/src/lib.rs" <<'RS'
//! Docs mention [`Thing`].
//! 
//! Also mentions [`Thing`] in the crate docs.

#[cfg(not(target_arch = "wasm32"))]
pub struct Thing;
RS

cargo rustdoc --manifest-path "$tmpdir/Cargo.toml" --target wasm32-unknown-unknown -- -D warnings

Repository: dashpay/platform

Length of output: 899


🌐 Web query:

rustdoc intra-doc link cfg-gated item unresolved on target_arch wasm32 warnings denied

💡 Result:

When rustdoc encounters intra-doc links to items that are "cfg-gated" (hidden behind configuration flags like target_arch = "wasm32"), it frequently triggers the rustdoc::broken_intra_doc_links lint because the items are not available in the current documentation build environment [1][2]. Since rustdoc generates documentation based on the current configuration, it cannot resolve links to items that have been filtered out [3]. If you have configured your project to treat these warnings as errors (e.g., #![deny(rustdoc::broken_intra_doc_links)]), the documentation build will fail [4][5]. To address this, you can use the following common approaches: 1. Use cfg(doc) to expose the item to rustdoc: You can use #[cfg(any(doc, target_arch = "wasm32"))] on your item. This ensures that the item is visible to rustdoc during documentation generation, regardless of the target architecture, while remaining restricted during normal compilation [3]. 2. Build with the relevant flags: If you are using Cargo, you can run cargo doc with the necessary flags to ensure all items are included. For feature gates, this is often cargo doc --all-features. However, for target-specific code, this may be more complex as standard cargo doc only documents for the host target [1][3]. 3. Allow or suppress the warning: If you cannot or do not wish to expose the item, you can specifically allow the lint in the module where the broken link occurs: #[allow(rustdoc::broken_intra_doc_links)] [4][5]. Note that there is no automatic mechanism for rustdoc to "intelligently" resolve these links or know that an item is intentionally cfg-ed out; it currently relies on the provided environment's configuration [1][2].

Citations:


Avoid the unconditional [ThreadRegistry] link here. ThreadRegistry is cfg-gated out on wasm32, so this crate-level doc link can break a wasm32 rustdoc build with broken intra-doc links denied. Use plain code formatting or gate the link behind the same cfg.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/rs-dash-async/src/lib.rs` around lines 5 - 8, The crate-level
documentation unconditionally links to cfg-gated ThreadRegistry, which breaks
wasm32 rustdoc builds. In the module documentation near the ThreadRegistry
reference, replace the intra-doc link with plain code formatting or
conditionally include the link using the same wasm32 cfg as ThreadRegistry.


mod block_on;
#[cfg(not(target_arch = "wasm32"))]
mod registry;

pub use block_on::{block_on, AsyncError};
#[cfg(not(target_arch = "wasm32"))]
pub use registry::{
ClearingGuard, DrainHook, RegistryKey, ShutdownReport, ShutdownWeight, ThreadRegistry,
WorkerConfig, WorkerStatus, DEFAULT_JOIN_BUDGET, DEFAULT_REAP_BACKSTOP,
};
Loading
Loading