-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Refactor and fix intra-doc link diagnostics, and fix links to primitives #76955
Merged
Conversation
This file contains 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
jyn514
added
T-rustdoc
Relevant to the rustdoc team, which will review and decide on the PR/issue.
A-diagnostics
Area: Messages for errors, warnings, and lints
A-intra-doc-links
Area: Intra-doc links, the ability to link to items in docs by name
labels
Sep 20, 2020
jyn514
force-pushed
the
refactor-diagnostics
branch
from
September 20, 2020 07:10
b717d42
to
66a9cfa
Compare
jyn514
commented
Sep 20, 2020
euclio
reviewed
Sep 23, 2020
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.
LGTM with other comments addressed.
jyn514
force-pushed
the
refactor-diagnostics
branch
from
September 23, 2020 23:50
8c442fa
to
2abf18c
Compare
jyn514
added
the
S-waiting-on-review
Status: Awaiting review from the assignee but also interested parties.
label
Sep 23, 2020
Previously, these were spread throughout the codebase. This had two drawbacks: 1. It caused the fast path to be slower: even if a link resolved, rustdoc would still perform various lookups for the error diagnostic. 2. It was inconsistent and didn't always give all diagnostics (rust-lang#76925) Now, diagnostics only perform expensive lookups in the error case. Additionally, the error handling is much more consistent, both in wording and behavior. - Remove `CannotHaveAssociatedItems`, `NotInScope`, `NoAssocItem`, and `NotAVariant` in favor of the more general `NotResolved` `resolution_failure` will now look up which of the four above categories is relevant, instead of requiring the rest of the code to be consistent and accurate in which it picked. - Remove unnecessary lookups throughout the intra-doc link pass. These are now done by `resolution_failure`. + Remove unnecessary `extra_fragment` argument to `variant_field()`; it was only used to do lookups on failure. + Remove various lookups related to associated items + Remove distinction between 'not in scope' and 'no associated item' - Don't perform unnecessary copies - Remove unused variables and code - Update tests - Note why looking at other namespaces is still necessary - 'has no inner item' -> 'contains no item' bless tests
- Add `PrimTy::name` and `PrimTy::name_str` - Use those new functions to distinguish between the name in scope and the canonical name - Fix diagnostics for primitive types - Add tests for primitives
Now that `PrimTy::name()` exists, there's no need to carry around the name of the primitive that failed to resolve. This removes the variants special-casing primitives in favor of `NotResolved`. - Remove `NoPrimitiveImpl` and `NoPrimitiveAssocItem` - Remove hacky `has_primitive` check in `resolution_failure()` - Fixup a couple tests that I forgot to `--bless` before
jyn514
force-pushed
the
refactor-diagnostics
branch
from
September 24, 2020 01:07
2abf18c
to
049d29b
Compare
euclio
approved these changes
Sep 24, 2020
@bors r=euclio |
📌 Commit 049d29b has been approved by |
bors
added
S-waiting-on-bors
Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
and removed
S-waiting-on-review
Status: Awaiting review from the assignee but also interested parties.
labels
Sep 24, 2020
RalfJung
added a commit
to RalfJung/rust
that referenced
this pull request
Sep 25, 2020
Refactor and fix intra-doc link diagnostics, and fix links to primitives Closes rust-lang#76925, closes rust-lang#76693, closes rust-lang#76692. Originally I only meant to fix rust-lang#76925. But the hack with `has_primitive` was so bad it was easier to fix the primitive issues than to try and work around it. Note that this still has one bug: `std::primitive::i32::MAX` does not resolve. However, this fixes the ICE so I'm fine with fixing the link in a later PR. This is part of a series of refactors to make rust-lang#76467 possible. This is best reviewed commit-by-commit; it has detailed commit messages. r? @euclio
☀️ Test successful - checks-actions, checks-azure |
This was referenced Sep 27, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
A-intra-doc-links
Area: Intra-doc links, the ability to link to items in docs by name
merged-by-bors
This PR was explicitly merged by bors.
S-waiting-on-bors
Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
T-rustdoc
Relevant to the rustdoc team, which will review and decide on the PR/issue.
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.
Closes #76925, closes #76693, closes #76692.
Originally I only meant to fix #76925. But the hack with
has_primitive
was so bad it was easier to fix the primitive issues than to try and work around it.Note that this still has one bug:
std::primitive::i32::MAX
does not resolve. However, this fixes the ICE so I'm fine with fixing the link in a later PR.This is part of a series of refactors to make #76467 possible.
This is best reviewed commit-by-commit; it has detailed commit messages.
r? @euclio