Fix ICE when documentation includes intra-doc-link#66211
Merged
bors merged 2 commits intorust-lang:masterfrom Nov 14, 2019
Merged
Fix ICE when documentation includes intra-doc-link#66211bors merged 2 commits intorust-lang:masterfrom
bors merged 2 commits intorust-lang:masterfrom
Conversation
This makes `rustdoc` support `--extern-private` but treats it the same as `--extern` which is useful for making the CLI more similar to `rustc` to ease test suite integration. Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
In order that we can successfully later resolve paths in crates which weren't loaded as a result of merely parsing the crate we're documenting, we force the resolution of the path to each crate before cloning the resolver to use later. Closes rust-lang#66159 Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
8077b91 to
33ded3e
Compare
Member
|
Just to be sure: if we don't pass the |
Contributor
Author
No, I had to add the capability in order to trigger the crash, otherwise it's just an unresolvable path. |
Member
Collaborator
|
📌 Commit 33ded3e has been approved by |
Collaborator
bors
added a commit
that referenced
this pull request
Nov 13, 2019
Fix ICE when documentation includes intra-doc-link When collecting intra-doc-links we could trigger the loading of extra crates into the crate store due to name resolution finding crates referred to in documentation but not in code. This might be due to configuration differences or simply referring to something else. This would cause an ICE because the newly loaded crate metadata existed in a crate store associated with the rustdoc global context, but the resolver had its own crate store cloned just before the documentation processing began and as such it could try and look up crates in a store which lacked them. In this PR, I add support for `--extern-private` to the `rustdoc` tool so that it is supported for `compiletest` to then pass the crates in; and then I fix the issue by forcing the resolver to look over all the crates before we then lower the input ready for processing into documentation. The first commit (the `--extern-private`) could be replaced with a commit which adds support for `--extern` to `compiletest` if preferred, though I think that adding `--extern-private` to `rustdoc` is more useful anyway since it makes the CLI a little more like `rustc`'s which might help reduce surprise for someone running it by hand or in their own test code. The PR is meant to fix #66159 though it may also fix #65840. cc @GuillaumeGomez
Collaborator
|
☀️ Test successful - checks-azure |
Merged
ollie27
reviewed
Nov 23, 2019
| stable("extern", |o| { | ||
| o.optmulti("", "extern", "pass an --extern to rustc", "NAME=PATH") | ||
| }), | ||
| stable("extern-private", |o| { |
Contributor
There was a problem hiding this comment.
This shouldn't be stable, it's not even stable in rustc: #66655
Member
|
@ollie27 Good catch! Sending a fix. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When collecting intra-doc-links we could trigger the loading of extra crates into the crate store due to name resolution finding crates referred to in documentation but not in code. This might be due to
configuration differences or simply referring to something else.
This would cause an ICE because the newly loaded crate metadata existed in a crate store associated with the rustdoc global context, but the resolver had its own crate store cloned just before the documentation processing began and as such it could try and look up crates in a store which lacked them.
In this PR, I add support for
--extern-privateto therustdoctool so that it is supported forcompiletestto then pass the crates in; and then I fix the issue by forcing the resolver to look over all the crates before we then lower the input ready for processing into documentation.The first commit (the
--extern-private) could be replaced with a commit which adds support for--externtocompiletestif preferred, though I think that adding--extern-privatetorustdocis more useful anyway since it makes the CLI a little more likerustc's which might help reduce surprise for someone running it by hand or in their own test code.The PR is meant to fix #66159 though it may also fix #65840.
cc @GuillaumeGomez