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

rustdoc: resolve intra-doc links to builtin macros #61916

Closed

Conversation

QuietMisdreavus
Copy link
Member

Fixes #61804

When rustdoc encounters an intra-doc link that resolves to a built-in macro, it attempts to load up the crate's name as it saves the information about the link target. However, this causes an ICE since the built-in macros don't come from a regular crate. This PR attempts to work around this by handling built-in macros separately, similarly to how it handles primitives - by linking to the standard library's documentation, where there are documentation stubs available to link against.

@Centril
Copy link
Contributor

Centril commented Jun 17, 2019

cc #61877 cc @petrochenkov

@QuietMisdreavus
Copy link
Member Author

Oh yikes, that PR is looking to remove CrateNum::BuiltinMacro entirely. That means this PR would need to find another way to detect that a resolution led to a builtin macro. 😓

@Centril
Copy link
Contributor

Centril commented Jun 17, 2019

@QuietMisdreavus Can you not use is_builtin_macro?

@QuietMisdreavus
Copy link
Member Author

I'd still have to rework the PR - one of the checks in this PR happens after the resolver is gone. And since rustdoc only saves DefIds, the Res::BuiltinMacro alternative discussed in #61877 (comment) wouldn't work as easily, either.

@GuillaumeGomez GuillaumeGomez added the T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. label Jun 18, 2019
@jonas-schievink jonas-schievink added the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Jun 18, 2019
@QuietMisdreavus
Copy link
Member Author

It looks like #61877 was closed, and was replaced by #62086. Looking at the discussion of what it's intended to do, it's possible that that may obviate this PR and fix the linked issue with no work in rustdoc itself.

@petrochenkov
Copy link
Contributor

Closing as superseded by #62086.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ICE: rustdoc: Tried to get crate index of builtin macros crate
6 participants