Repository navigation
False warnings with cargo doc. #58745
Description
Activity
- addedT-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.Relevant to the rustdoc team, which will review and decide on the PR/issue.A-intra-doc-linksArea: Intra-doc links, the ability to link to items in docs by nameArea: Intra-doc links, the ability to link to items in docs by nameC-bugCategory: This is a bug.Category: This is a bug.
on Feb 26, 2019 I'll take a look.
I took a closer look at this yesterday and today, and found some of the warnings that were in fact spurious - the ones that corresponded to a link that was actually resolved on the item's page. I've opened #58972 to fix those.
However, there were some left that were not spurious in the same way. These all tripped a warning because the links can resolve in the original location in the original crate, but not the re-exported location in the facade crate. (The links are resolved all over again each time the item re-exports into a full page - the information isn't saved across crates, so as a hack we use the location of the re-export to resolve links.) Once #58972 is merged, the remaining warnings will need more effort to fix.
EDIT: I'd meant to give an example of an actual resolution failure - in the
RngCoretrait docs, it links to animplsmodule, which is present in therand_corecrate whereRngCoreis declared, but is not present in therandcrate where it's re-exported. This causes the link to fail to render, causing an erroneous[impls]to appear in the rendered documentation.Another example is the
TimerErrorenum, re-exported from therand_jittercrate. It links back to a method its originalJitterRngstruct via the intra-doc linkcrate::JitterRng::test_timer, which is the correct path inrand_jitter, but not inrand- where the full path iscrate::rngs::JitterRng::test_timer.Thanks for looking into this.
The latter issues sound tricky to solve — correct documentation for an item presented differently in two different places. I wonder if
docattributes could be made optional depending on which crate the item is being exported from? Ideally here we'd just want a different path fortest_timerbut significantly different docs forRngCore.@QuietMisdreavus and I handled the issue differently: I don't show errors on items that are outside of the current crate and they prevent to read non-local items (so no errors since it's not parsed).
Reacted by Diggory HardyThese all tripped a warning because the links can resolve in the original location in the original crate, but not the re-exported location in the facade crate.
This sounds like it will be fixed by #73101, but I haven't tested on these exact crates.
I documented rand without warnings on the latest nightly, and the upstream issue has been closed (rust-random/rand#737), so I'm going to close this as well. Feel free to re-open if you still have issues!
First raised this issue with
rust-random/randrust-random/rand#737. But the documentation links seem to work fine. So may be it is false-warning raised bycargo doc?How to reproduce ?