Skip to content
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

Add docs for intra-doc-links #73810

Closed
wants to merge 2 commits into from

Conversation

Manishearth
Copy link
Member

Fixes #66000

@rust-highfive
Copy link
Collaborator

r? @GuillaumeGomez

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jun 27, 2020
Copy link
Member

@jyn514 jyn514 left a comment

Choose a reason for hiding this comment

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

This should mention which scope is used to resolve the links: the parent module of the item. In the case of macros this is the crate root; in the case of re-exports it is the original module; in the case of impls I believe it's the parent of the type (but not sure).

@Manishearth
Copy link
Member Author

@jyn514 isn't it just the def site scope? I don't think there's any special scoping here

@jyn514
Copy link
Member

jyn514 commented Jun 29, 2020

Sure, it's obvious to us because we implemented it, but it's not obvious to everyone else. See e.g. #72243 which is a bug report that macros aren't resolved using lexical scope instead of resolution scope.

@Manishearth
Copy link
Member Author

@jyn514 Oh, I do consider that special scoping, I wasn't aware of that. For everything else it's just the def site scope though. I think we can mention that macro_rules are scoped differently

@Manishearth
Copy link
Member Author

Added a note. We'll be deprecating macro_rules anyway so I don't think we should do much more here

For example, in the following code all of the links will link to the rustdoc page for `Bar`:

```rust

Copy link
Member

Choose a reason for hiding this comment

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

Please remove this empty line.

@GuillaumeGomez
Copy link
Member

Overall, it is nice. Could you also add the fact that using crate:: or paths more generally work just like imports too please?

@Manishearth Manishearth closed this Jul 9, 2020
@Manishearth Manishearth deleted the doc-intra-doc branch July 9, 2020 15:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Document intra-rustdoc links in the unstable book
4 participants