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

Remove header field from clean::Function #95096

Merged
merged 3 commits into from
Mar 29, 2022

Conversation

GuillaumeGomez
Copy link
Member

Fixes #89673.

This is another take on #89673 (compared to #91217) but very different on the approach: I moved the header call in one place but still require to have the clean::Item so I can use the DefId to get what is missing.

cc @jyn514 (you reviewed the original so maybe you want to take a look?)
r? @camelid

@rustbot rustbot added the T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. label Mar 19, 2022
@rust-highfive
Copy link
Collaborator

Some changes occurred in clean/types.rs.

cc @camelid

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Mar 19, 2022
src/librustdoc/clean/types.rs Outdated Show resolved Hide resolved
src/librustdoc/clean/types.rs Outdated Show resolved Hide resolved
src/librustdoc/clean/types.rs Outdated Show resolved Hide resolved
@GuillaumeGomez
Copy link
Member Author

Forgot to run the perf check.

@bors try @rust-timer queue

@rust-timer
Copy link
Collaborator

Awaiting bors try build completion.

@rustbot label: +S-waiting-on-perf

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Mar 19, 2022
@bors
Copy link
Contributor

bors commented Mar 19, 2022

⌛ Trying commit 460442576cda0a8e3f6a36023cbfc96d15e1124a with merge adc3dafa0f99c69b5c77712a174931437f4701a3...

@bors
Copy link
Contributor

bors commented Mar 19, 2022

☀️ Try build successful - checks-actions
Build commit: adc3dafa0f99c69b5c77712a174931437f4701a3 (adc3dafa0f99c69b5c77712a174931437f4701a3)

@rust-timer
Copy link
Collaborator

Queued adc3dafa0f99c69b5c77712a174931437f4701a3 with parent 3153584, future comparison URL.

@GuillaumeGomez
Copy link
Member Author

Applied suggestions.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (adc3dafa0f99c69b5c77712a174931437f4701a3): comparison url.

Summary: This benchmark run shows 39 relevant improvements 🎉 to instruction counts.

  • Arithmetic mean of relevant improvements: -0.9%
  • Largest improvement in instruction counts: -1.4% on full builds of issue-46449 doc

If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf.

Benchmarking 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 led to changes in compiler perf.

@bors rollup=never
@rustbot label: +S-waiting-on-review -S-waiting-on-perf -perf-regression

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Mar 19, 2022
@GuillaumeGomez
Copy link
Member Author

Nice improvements overall! For the rss usage, we have -0.93% on primary benchmarks and -1.16% on secondary benchmarks.

I also added a test which reexports a foreign function from a dependency to be sure there is no issue with the HirId.

src/librustdoc/clean/types.rs Outdated Show resolved Hide resolved
@camelid camelid added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 23, 2022
@GuillaumeGomez GuillaumeGomez added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Mar 24, 2022
@GuillaumeGomez GuillaumeGomez force-pushed the rm-header-fn-field branch 2 times, most recently from b0798bd to 8ce764c Compare March 24, 2022 13:47
@GuillaumeGomez
Copy link
Member Author

Updated!

@@ -795,13 +792,6 @@ fn clean_fn_or_proc_macro(
}
None => {
let mut func = clean_function(cx, sig, generics, body_id);
let def_id = item.def_id.to_def_id();
func.header.constness =
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed several places where the constness is overrided like this. I don't quite understand why this code existed. Does the new, on-demand computation account for the old overriding behavior?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Likewise, some places used is_const_fn_raw while others used is_const_fn. Is this handled properly?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was more or less the same code done by different functions. We have a lot of rustdoc tests for functions and methods to ensure their signature is as expected (I know it because I broke a lot of them while working on this PR).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, seems good to me then. It's good to know the tests worked as intended and failed with previous versions of the code :)

@camelid camelid added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 27, 2022
@GuillaumeGomez GuillaumeGomez removed the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Mar 28, 2022
@GuillaumeGomez GuillaumeGomez added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Mar 28, 2022
Copy link
Member

@camelid camelid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

r=me with the following comments addressed

Thanks for this refactor!

@@ -795,13 +792,6 @@ fn clean_fn_or_proc_macro(
}
None => {
let mut func = clean_function(cx, sig, generics, body_id);
let def_id = item.def_id.to_def_id();
func.header.constness =
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, seems good to me then. It's good to know the tests worked as intended and failed with previous versions of the code :)

src/librustdoc/clean/types.rs Outdated Show resolved Hide resolved
src/librustdoc/html/render/print_item.rs Show resolved Hide resolved
@camelid camelid added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 28, 2022
@GuillaumeGomez
Copy link
Member Author

@bors: r=camelid rollup=never

@bors
Copy link
Contributor

bors commented Mar 29, 2022

📌 Commit 8071332 has been approved by camelid

@bors 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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Mar 29, 2022
@bors
Copy link
Contributor

bors commented Mar 29, 2022

⌛ Testing commit 8071332 with merge 11909e3...

@bors
Copy link
Contributor

bors commented Mar 29, 2022

☀️ Test successful - checks-actions
Approved by: camelid
Pushing 11909e3 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Mar 29, 2022
@bors bors merged commit 11909e3 into rust-lang:master Mar 29, 2022
@rustbot rustbot added this to the 1.61.0 milestone Mar 29, 2022
@GuillaumeGomez GuillaumeGomez deleted the rm-header-fn-field branch March 29, 2022 15:32
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (11909e3): comparison url.

Summary: This benchmark run shows 30 relevant improvements 🎉 to instruction counts.

  • Arithmetic mean of relevant regressions: 0.3%
  • Arithmetic mean of relevant improvements: -0.9%
  • Arithmetic mean of all relevant changes: -0.8%
  • Largest improvement in instruction counts: -1.4% on full builds of await-call-tree doc

If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf.

@rustbot label: -perf-regression

Dylan-DPC added a commit to Dylan-DPC/rust that referenced this pull request Mar 31, 2022
…g, r=notriddle

Remove unneeded `to_string` call

Fixes a confusion I made when reading `@camelid's` comment [here](rust-lang#95096 (comment)).

r? `@notriddle`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Get rid of clean::Function::header once #85833 is merged
7 participants