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

modularize rustdoc's write_shared #128252

Merged
merged 6 commits into from
Aug 20, 2024
Merged

modularize rustdoc's write_shared #128252

merged 6 commits into from
Aug 20, 2024

Conversation

EtomicBomb
Copy link
Contributor

@EtomicBomb EtomicBomb commented Jul 26, 2024

Refactor src/librustdoc/html/render/write_shared.rs to reduce code duplication, adding unit tests

  • Extract + unit test code for sorting and rendering JSON, which is duplicated 9 times in the current impl
  • Extract + unit test code for encoding JSON as single quoted strings, which is duplicated twice in the current impl
  • Unit tests for cross-crate information file formats
  • Generic interface to add new kinds of cross-crate information files in the future
  • Intended to match current behavior exactly, except for a merge info comment it adds to the bottom of cci files
  • This PR is intended to reduce the review burden from my mergeable rustdoc rfc implementation PR, which is a small commit based on this branch. This code is agnostic to the RFC and does not include any of the flags discussed there, but cleanly enables the addition of these flags in the future because it is more modular

@rustbot
Copy link
Collaborator

rustbot commented Jul 26, 2024

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @fmease (or someone else) some time within the next two weeks.

Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (S-waiting-on-review and S-waiting-on-author) stays updated, invoking these commands when appropriate:

  • @rustbot author: the review is finished, PR author should check the comments and take action accordingly
  • @rustbot review: the author is ready for a review, this PR will be queued again in the reviewer's queue

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Jul 26, 2024
@bors
Copy link
Contributor

bors commented Jul 29, 2024

☔ The latest upstream changes (presumably #125443) made this pull request unmergeable. Please resolve the merge conflicts.

@bors
Copy link
Contributor

bors commented Jul 30, 2024

☔ The latest upstream changes (presumably #128360) made this pull request unmergeable. Please resolve the merge conflicts.

@rustbot rustbot added has-merge-commits PR has merge commits, merge with caution. S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Aug 7, 2024
@rustbot
Copy link
Collaborator

rustbot commented Aug 7, 2024

There are merge commits (commits with multiple parents) in your changes. We have a no merge policy so these commits will need to be removed for this pull request to be merged.

You can start a rebase with the following commands:

$ # rebase
$ git pull --rebase https://github.com/rust-lang/rust.git master
$ git push --force-with-lease

The following commits are merge commits:

@rustbot rustbot added A-testsuite Area: The testsuite used to check the correctness of rustc T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) labels Aug 7, 2024
@rustbot

This comment was marked as resolved.

@rustbot rustbot removed has-merge-commits PR has merge commits, merge with caution. S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Aug 7, 2024
use serde::{Deserialize, Serialize};
use serde_json::Value;

/// Prerenedered json.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
/// Prerenedered json.
/// Prerendered json.

impl OrderedJson {
/// If you pass in an array, it will not be sorted.
pub(crate) fn serialize<T: Serialize>(item: T) -> Result<Self, serde_json::Error> {
Ok(OrderedJson(serde_json::to_string(&item)?))
Copy link
Member

Choose a reason for hiding this comment

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

Please use Self as much as possible. It makes it easier if the type name is updated later on.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for taking a look Guillaume!

@GuillaumeGomez
Copy link
Member

Lot of things are going on here. Since it's updating the search index, cc @notriddle

Also, I'm curious about the perf impact.

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Aug 8, 2024
bors added a commit to rust-lang-ci/rust that referenced this pull request Aug 8, 2024
modularize rustdoc's write_shared

Refactor src/librustdoc/html/render/write_shared.rs to reduce code duplication, adding unit tests

* Extract + unit test code for sorting and rendering JSON, which is duplicated 9 times in the current impl
* Extract + unit test code for encoding JSON as single quoted strings, which is duplicated twice in the current impl
* Unit tests for cross-crate information file formats
* Generic interface to add new kinds of cross-crate information files in the future
* Intended to match current behavior exactly, except for a merge info comment it adds to the bottom of cci files
* This PR is intended to reduce the review burden from my [mergeable rustdoc rfc](rust-lang/rfcs#3662) implementation PR, which is a [small commit based on this branch](https://github.com/EtomicBomb/rust/tree/rfc). This code is agnostic to the RFC and does not include any of the flags discussed there, but cleanly enables the addition of these flags in the future because it is more modular
@bors
Copy link
Contributor

bors commented Aug 8, 2024

⌛ Trying commit 4b418cd with merge 7853224...

@bors
Copy link
Contributor

bors commented Aug 8, 2024

☀️ Try build successful - checks-actions
Build commit: 7853224 (78532246c441b283a4341a16648b57d3c67f4a9a)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (7853224): comparison URL.

Overall result: no relevant changes - no action needed

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 may lead to changes in compiler perf.

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

Instruction count

This benchmark run did not return any relevant results for this metric.

Max RSS (memory usage)

Results (primary -3.4%, secondary 2.3%)

This 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.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
2.3% [2.3%, 2.3%] 1
Improvements ✅
(primary)
-3.4% [-3.4%, -3.4%] 1
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -3.4% [-3.4%, -3.4%] 1

Cycles

Results (secondary 2.4%)

This 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.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
2.4% [2.1%, 2.8%] 3
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) - - 0

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 762.874s -> 764.314s (0.19%)
Artifact size: 337.10 MiB -> 337.16 MiB (0.02%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Aug 8, 2024
typos in comments, remove references to crate-info, Self type in
ordered_json and sorted_template
@notriddle
Copy link
Contributor

@bors r+

@bors
Copy link
Contributor

bors commented Aug 20, 2024

📌 Commit b4f057f has been approved by notriddle

It is now in the queue for this repository.

@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-review Status: Awaiting review from the assignee but also interested parties. labels Aug 20, 2024
@bors
Copy link
Contributor

bors commented Aug 20, 2024

⌛ Testing commit b4f057f with merge 5aea140...

@bors
Copy link
Contributor

bors commented Aug 20, 2024

☀️ Test successful - checks-actions
Approved by: notriddle
Pushing 5aea140 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Aug 20, 2024
@bors bors merged commit 5aea140 into rust-lang:master Aug 20, 2024
7 checks passed
@rustbot rustbot added this to the 1.82.0 milestone Aug 20, 2024
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (5aea140): comparison URL.

Overall result: no relevant changes - no action needed

@rustbot label: -perf-regression

Instruction count

This benchmark run did not return any relevant results for this metric.

Max RSS (memory usage)

Results (primary -0.9%)

This 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.

mean range count
Regressions ❌
(primary)
0.9% [0.9%, 0.9%] 1
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-2.7% [-2.7%, -2.7%] 1
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -0.9% [-2.7%, 0.9%] 2

Cycles

This benchmark run did not return any relevant results for this metric.

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 749.351s -> 748.876s (-0.06%)
Artifact size: 338.82 MiB -> 338.91 MiB (0.03%)

notriddle added a commit to notriddle/rust that referenced this pull request Aug 27, 2024
notriddle added a commit to notriddle/rust that referenced this pull request Aug 27, 2024
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Aug 28, 2024
…-js-resource-suffix, r=GuillaumeGomez

rustdoc: fix missing resource suffix on `crates.js`

Fixes a regression introduced in rust-lang#128252.
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Aug 28, 2024
Rollup merge of rust-lang#129641 - notriddle:notriddle/missing-crates-js-resource-suffix, r=GuillaumeGomez

rustdoc: fix missing resource suffix on `crates.js`

Fixes a regression introduced in rust-lang#128252.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-testsuite Area: The testsuite used to check the correctness of rustc 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-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) 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.

7 participants