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. Fixed!

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.
@cwfitzgerald cwfitzgerald self-assigned this Nov 26, 2025
Copy link
Member

@cwfitzgerald cwfitzgerald left a comment

Choose a reason for hiding this comment

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

Good stuff! Conditional approved on this one nit

As a bonus, the macro now allows defining such links while writing the item name only once instead of twice.
@cwfitzgerald cwfitzgerald merged commit fa4c8e8 into gfx-rs:trunk Nov 27, 2025
41 checks passed
@kpreid kpreid deleted the doclink branch November 27, 2025 17:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants