-
Notifications
You must be signed in to change notification settings - Fork 12.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
rustdoc: Resolve module-level doc references more locally #65857
Conversation
b80a43d
to
2a6f77d
Compare
Given where the code is, is it worth @QuietMisdreavus or @Manishearth reviewing this? |
With this change, I'm afraid it might not find items located in the parents. Could you provide tests alongside please? (we should have added them from the start...)
Their opinion would be very valuable indeed! |
I 100% agree with the need for tests, but I'm unsure about how the rustdoc tests quite work -- all the If you can give me an example of what you mean by "not find items located in the parents" in terms of an example bit of Rust, I'll add tests for the stuff in the original issue, and also your test cases. I'm fairly sure that all the existing stuff passes though. |
2a6f77d
to
50722e7
Compare
I found |
The test looks good but I'd feel more at ease if you used the syntax I provided you to check the href. :) Also, do you mind checking with bigger modules levels (like 4 or even 5 levels down?). Thanks in advance! |
@GuillaumeGomez To ease review I've pushed two fixup commits. The first changes the XPATHs the way you asked for (and I think they're better this way yes, so thank you). The second adds a five level deep submodule set which refers to sibling modules by means of Any other tests you'd like me to add? I'm quite liking the |
The third fixup is just to quiet Once things look good, I'll obviously rebase these into a nice commit. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
r=me with a comment explaining what base_node is
22342a0
to
d0bcd12
Compare
src/test/rustdoc/issue-55364.rs
Outdated
|
||
// @has issue_55364/index.html | ||
// These two functions should refer to each other | ||
// @has - '//section[@id="main"]/table//a[@href="fn.foo.html"]' 'foo' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're currently checking that the module has a function url. Functions have pages on their own as well. For example: https://doc.rust-lang.org/nightly/std/mem/fn.drop.html
Please update your test to check for the functions' doc and not if the module has a link to the function. :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I figure given the above two tests, I can just remove these particular checks. Is that okay?
d0bcd12
to
33b21d9
Compare
Thanks a lot! @bors: r=Manisheart,GuillaumeGomez |
📌 Commit 33b21d9cd23cb01f2f0bdcf38c2280074b2f070a has been approved by |
Module level docs should resolve intra-doc links as locally as possible. As such, this commit alters the heuristic for finding intra-doc links such that we attempt to resolve names mentioned in *inner* documentation comments within the (sub-)module rather that from the context of its parent. Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
33b21d9
to
c24a099
Compare
I've pushed a squashed commit so there's no |
@bors: r=Manisheart,GuillaumeGomez |
📌 Commit c24a099 has been approved by |
…nisheart,GuillaumeGomez rustdoc: Resolve module-level doc references more locally Module level docs should resolve intra-doc links as locally as possible. As such, this commit alters the heuristic for finding intra-doc links such that we attempt to resolve names mentioned in *inner* documentation comments within the (sub-)module rather that from the context of its parent. I'm hoping that this fixes rust-lang#55364 though right now I'm not sure it's the right fix. r? @GuillaumeGomez
Rollup of 14 pull requests Successful merges: - #65112 (Add lint and tests for unnecessary parens around types) - #65459 (Fix `-Zunpretty=mir-cfg` to render multiple items) - #65471 (Add long error explanation for E0578) - #65857 (rustdoc: Resolve module-level doc references more locally) - #65914 (Use structured suggestion for unnecessary bounds in type aliases) - #65945 (Optimize long-linker-command-line test) - #65946 (Make `promote_consts` emit the errors when required promotion fails) - #65960 (doc: reword iter module example and mention other methods) - #65963 (update submodules to rust-lang) - #65972 (Fix libunwind build: Define __LITTLE_ENDIAN__ for LE targets) - #65977 (Fix incorrect diagnostics for expected type in E0271 with an associated type) - #65995 (Add error code E0743 for "C-variadic has been used on a non-foreign function") - #65997 (Fix outdated rustdoc of Once::init_locking function) - #66005 (vxWorks: remove code related unix socket) Failed merges: r? @ghost
…nisheart,GuillaumeGomez rustdoc: Resolve module-level doc references more locally Module level docs should resolve intra-doc links as locally as possible. As such, this commit alters the heuristic for finding intra-doc links such that we attempt to resolve names mentioned in *inner* documentation comments within the (sub-)module rather that from the context of its parent. I'm hoping that this fixes rust-lang#55364 though right now I'm not sure it's the right fix. r? @GuillaumeGomez
Rollup of 16 pull requests Successful merges: - #65112 (Add lint and tests for unnecessary parens around types) - #65470 (Don't hide ICEs from previous incremental compiles) - #65471 (Add long error explanation for E0578) - #65857 (rustdoc: Resolve module-level doc references more locally) - #65902 (Make ItemContext available for better diagnositcs) - #65914 (Use structured suggestion for unnecessary bounds in type aliases) - #65946 (Make `promote_consts` emit the errors when required promotion fails) - #65960 (doc: reword iter module example and mention other methods) - #65963 (update submodules to rust-lang) - #65972 (Fix libunwind build: Define __LITTLE_ENDIAN__ for LE targets) - #65977 (Fix incorrect diagnostics for expected type in E0271 with an associated type) - #65995 (Add error code E0743 for "C-variadic has been used on a non-foreign function") - #65997 (Fix outdated rustdoc of Once::init_locking function) - #66002 (Stabilize float_to_from_bytes feature) - #66005 (vxWorks: remove code related unix socket) - #66018 (Revert PR 64324: dylibs export generics again (for now)) Failed merges: r? @ghost
Module level docs should resolve intra-doc links as locally as
possible. As such, this commit alters the heuristic for finding
intra-doc links such that we attempt to resolve names mentioned
in inner documentation comments within the (sub-)module rather
that from the context of its parent.
I'm hoping that this fixes #55364 though right now I'm not sure it's the right fix.
r? @GuillaumeGomez