-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Conversation
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 (
|
☔ The latest upstream changes (presumably #125443) made this pull request unmergeable. Please resolve the merge conflicts. |
☔ The latest upstream changes (presumably #128360) made this pull request unmergeable. Please resolve the merge conflicts. |
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:
The following commits are merge commits: |
This comment was marked as resolved.
This comment was marked as resolved.
use serde::{Deserialize, Serialize}; | ||
use serde_json::Value; | ||
|
||
/// Prerenedered json. |
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.
/// 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)?)) |
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.
Please use Self
as much as possible. It makes it easier if the type name is updated later on.
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.
Thanks for taking a look Guillaume!
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 |
This comment has been minimized.
This comment has been minimized.
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
☀️ Try build successful - checks-actions |
This comment has been minimized.
This comment has been minimized.
Finished benchmarking commit (7853224): 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)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.
CyclesResults (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.
Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 762.874s -> 764.314s (0.19%) |
typos in comments, remove references to crate-info, Self type in ordered_json and sorted_template
@bors r+ |
☀️ Test successful - checks-actions |
Finished benchmarking commit (5aea140): comparison URL. Overall result: no relevant changes - no action needed@rustbot label: -perf-regression Instruction countThis 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.
CyclesThis benchmark run did not return any relevant results for this metric. Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 749.351s -> 748.876s (-0.06%) |
Fixes a regression introduced in rust-lang#128252.
Fixes a regression introduced in rust-lang#128252.
…-js-resource-suffix, r=GuillaumeGomez rustdoc: fix missing resource suffix on `crates.js` Fixes a regression introduced in rust-lang#128252.
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.
Refactor src/librustdoc/html/render/write_shared.rs to reduce code duplication, adding unit tests