-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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: Skip doc link resolution for non-exported items #107932
Conversation
r? @jsha (rustbot has picked a reviewer for you, use r? to override) |
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
⌛ Trying commit 80beaa506705af5943b272dd0bc262e4668f47db with merge aac432a34739ec6dd1fd66a287cf34e17a8c49f8... |
☀️ Try build successful - checks-actions |
This comment has been minimized.
This comment has been minimized.
Finished benchmarking commit (aac432a34739ec6dd1fd66a287cf34e17a8c49f8): comparison URL. Overall result: no relevant changes - no action neededBenchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR may lead to changes in compiler perf. @bors rollup=never Instruction countThis benchmark run did not return any relevant results for this metric. Max RSS (memory usage)ResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
|
80beaa5
to
d15720b
Compare
Are benchmarks run with Anyway, this is a cheap optimization that can skip extra work in some cases, and it's done in other situations ( |
This comment was marked as resolved.
This comment was marked as resolved.
d15720b
to
efa5bc9
Compare
@rustbot r? compiler who can have a second look at this from the perspective of T-compiler? edit: for context, this PR was discussed in a previous T-compiler meeting (on zulip) trying to stimulate a review but apparently the domain of knowledge involved in the review does not allow a simple random review assignment. We need another T-compiler person able to review these changes |
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.
The code looks good and the change makes sense to me (this is just a perf optimization, right, it shouldn't affect behavior?).
r=me with the suggested test case added.
if !self.cx.render_options.document_private | ||
&& let Some(def_id) = item.item_id.as_def_id() | ||
&& let Some(def_id) = def_id.as_local() | ||
&& !self.cx.tcx.effective_visibilities(()).is_exported(def_id) |
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.
Are you sure is_exported
is the correct thing here, and not is_reachable
? Can you add a test case for
mod private {
/// [core::str::FromStr]
pub struct Bar;
}
pub fn foo() -> private::Bar {
private::Bar
}
and make sure it behaves the same both before and after this change?
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.
In both cases Bar
is not documented and Bar
in pub fn foo() -> Bar
in the generated doc is not a link.
Rustdoc uses is_reachable
in only one place when it generates json output, and I'm not sure why.
Actually hold on - all private items should already be stripped from the crate at this point (see rust/src/librustdoc/passes/strip_private.rs Lines 15 to 17 in 0e8f0b0
!is_exported() check to the intra-doc links pass?
|
This comment was marked as resolved.
This comment was marked as resolved.
efa5bc9
to
055a94c
Compare
And ICE when documenting liballoc.
rustdoc still tries to request resolution for a link on some non-exported item. It seems like it doesn't happen often due to the item stripping pass, so there's no effect on performance, but does happen. |
Inner doc comment on the
|
055a94c
to
bec4eab
Compare
@rustbot ready |
This seems like a pre-existing bug I would like to investigate, but it doesn't have to block this PR. @bors r+ |
⌛ Testing commit bec4eab with merge fd46bb408dba5d3e0a34a4e490ef1f838264f616... |
💔 Test failed - checks-actions |
@bors retry github incident |
☀️ Test successful - checks-actions |
Finished benchmarking commit (8be3c2b): comparison URL. Overall result: ❌ regressions - no action needed@rustbot label: -perf-regression Instruction countThis is a highly reliable metric that was used to determine the overall result at the top of this comment.
Max RSS (memory usage)ResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesThis benchmark run did not return any relevant results for this metric. |
No description provided.