-
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: Cache resolved links #77700
Conversation
Some changes occurred in intra-doc-links. cc @jyn514 |
(rust_highfive has picked a reviewer for you, use r? to override) |
3a4f812
to
ff4f5c6
Compare
So right now, 2 tests (should) have issues, because some [error] links are expected to fire errors multiple times. I plan on changing those tests so the links in them are unique and emit the expected errors. |
//! , [Uniooon::X] and [Qux::Z]. | ||
//~^ WARNING `Uniooon::X` | ||
//~| WARNING `Qux::Z` | ||
//! , [Uniooon::Y] and [Qux::W]. | ||
//~^ WARNING `Uniooon::Y` | ||
//~| WARNING `Qux::W` |
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.
@Manishearth do you know what this is meant to test? Is it that you get a warning on different items?
If it's just testing the warning is emitted at all I'd rather use the cases in intra-link-errors.rs
I think.
a2318a6
to
ce944bb
Compare
return; | ||
} | ||
(parts[0], Some(parts[1].to_owned())) | ||
Some(parts[1].to_owned()) |
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.
Doesn't need to be fixed here, but I wonder if this copy is actually necessary ...
@@ -563,14 +559,14 @@ impl<'a, 'tcx> LinkCollector<'a, 'tcx> { | |||
current_item: &Option<String>, | |||
extra_fragment: &Option<String>, | |||
) -> Option<Res> { | |||
let check_full_res_inner = |this: &Self, result: Result<Res, ErrorKind<'_>>| { | |||
let check_full_res_inner = |this: &Self, result: Result<Res, ErrorKind>| { |
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.
This function could be reworked to not have any closures and not be longer as it is currently. I wanted to do it, but for the sake of minimalism, this PR is a mess right now anyway and doesn't need any more.
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.
Sure, seems like a good follow-up but I agree it should be separate.
Why did you make this change? Performance only matters if there are no errors, and it made the code a lot more complicated |
I think I've been doing this for too long today and misunderstood you somewhere :) |
Feel free to take a break :) I have homework I should be doing too 😆 |
I didn't undo my lifetime-related changes, but I can if the Cow -> String is inconvenient. |
46a2338
to
cca98a2
Compare
More that it causes unnecessary copies; it's probably not necessary but I'd rather not remove it since it's already there. |
c4b165d
to
696cb27
Compare
Looks like this is now adding suggestions based on the original text instead of a normalized version, which isn't correct: |
Yup, I know, maybe I broke it during rebase |
696cb27
to
fa64c27
Compare
@jyn514 I undid the last two commits - the ones that spread the DiagInfo love around. I made at least two mistakes somewhere (the two commits had two different sets of test failures) and I don't have the brainpower to debug that right now. Also, the patch that depends on this one will conflict with the current split of diagnostic/resolution data. So right now this PR is a bit undercooked, but at least tests pass (locally). |
Sounds good to me, those probably belonged in different PRs anyway. I am not sure when rust-lang/rustc-perf#802 will be merged :( if it isn't by Friday I think we should just merge this anyway. Delegating to you in case I forget. @bors delegate=bugadani |
✌️ @bugadani can now approve this pull request |
📌 Commit fa64c27 has been approved by |
⌛ Testing commit fa64c27 with merge a1321f94ae00930fe0e091defe47f8d0dce31df1... |
💔 Test failed - checks-actions |
@bors retry I feel like I've seen this spurious error before, @rust-lang/infra do you recognize it? |
☀️ Test successful - checks-actions |
kind = ResolutionFailure::WrongNamespace(res, ns); | ||
break; | ||
} | ||
} | ||
} | ||
resolution_failure( | ||
self, | ||
&item, | ||
diag.item, |
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.
Why not just change these 4 arguments to take diag?
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.
Either it was forgotten, or resolution_failure
is called in a lot of places where creating DiagInfo would have been a chore. I don't recall exactly.
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.
Yes, a few other places but they could be made to use the struct.
A step towards #77681