Skip to content

Conversation

@kpreid
Copy link
Collaborator

@kpreid kpreid commented Nov 25, 2025

As a bonus, the macro now allows defining such links while writing the item name only once instead of twice.

Connections
Fixes #8199 (mostly).

Description
../<other crate> is not sufficient to link to another crate on docs.rs. This PR adds a macro which generates links that will work on docs.rs when cfg(docsrs) is set. The macro only applies to wgpu-types; it would be trickier to make it work for links in wgpu-core and wgpu-hal, but those links were fewer and less significant, so I figured it wasn't immediately worth doing.

I discovered a presumed bug in docs.rs, rust-lang/docs.rs#3036, and this PR contains a workaround for it which will link to older documentation than ideal. The alternative would be to embed the latest version number of wgpu into wgpu-types, which seems worse.

Testing

  • Clicked links in cargo doc to test local docs
  • Ran RUSTDOCFLAGS='--cfg=docsrs' cargo doc, manually edited together the resulting URLs with https://docs.rs/, and verified they worked in docs.rs.

Squash or Rebase?
One commit

Checklist

  • Run cargo fmt.
  • Run taplo format.
  • Run cargo clippy --tests. If applicable, add:
    • --target wasm32-unknown-unknown
  • Run cargo xtask test to run tests.
  • If this contains user-facing changes, add a CHANGELOG.md entry.

As a bonus, the macro now allows defining such links while writing the
item name only once instead of twice.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Inter-crate links are broken on docs.rs

1 participant