intra doc links towards parent crate succeed but create warnings · Issue #73699 · rust-lang/rust (original) (raw)

Problem

intra doc links towards parent crate succeed when generating docs for the parent crate but creates warnings like:

warning: `[Device]` cannot be resolved, ignoring it.
   --> /home/rukai2/Projects/Crates/wgpu/wgpu/wgpu-types/src/lib.rs:343:18
    |
343 | /// Describes a [`Device`].
    |                  ^^^^^^^^ cannot be resolved, ignoring
    |
    = note: `#[warn(intra_doc_link_resolution_failure)]` on by default
    = help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`

But we can see here that it succeeds: https://wgpu.rs/doc/wgpu/struct.DeviceDescriptor.html

Steps

  1. create a crate A
  2. create a crate B that depends on A and reexports types from A (specify as local path dependency, issue does not occur with git)
  3. a type in A contains intra doc links to types in B, which is then reexported by B. (only succeeds when reexported)
  4. run cargo +nightly doc on crate B
  5. This actually succeeds, which is great. Unfortunately it also creates warnings, that the type cannot be resolved.

Notes

Output of cargo version: cargo 1.46.0-nightly (089cbb80b 2020-06-15)

A workaround PR for this issue was made for wgpu gfx-rs/wgpu#748

This issue is kind of obscure, so I wouldnt be surprised if the best solution is for the user to just add an allow for the warning, but figured I would make an issue in case its useful.