summary refs log tree commit diff
path: root/src/librustdoc/html/render
AgeCommit message (Collapse)AuthorLines
2022-09-15rustdoc: use more precise URLs for jump-to-definition linksMichael Howell-0/+30
As an example, this cuts down <https://doc.rust-lang.org/nightly/nightly-rustc/src/rustc_middle/ty/mod.rs.html> by about 11%. $ du -h new_mod.rs.html old_mod.rs.html 296K new_mod.rs.html 332K old_mod.rs.html
2022-09-05Auto merge of #101228 - nnethercote:simplify-hir-PathSegment, r=petrochenkovbors-18/+16
Simplify `hir::PathSegment` r? `@petrochenkov`
2022-09-05Rollup merge of #101391 - matthiaskrgr:perf0309, r=oli-obkDylan DPC-3/+3
more clippy::perf fixes
2022-09-05Make `hir::PathSegment::hir_id` non-optional.Nicholas Nethercote-18/+16
2022-09-03Rustdoc-Json: Add enum discriminantNixon Enraght-Moony-1/+2
2022-09-03more clippy::perf fixesMatthias Krüger-3/+3
2022-09-01Rollup merge of #101245 - GuillaumeGomez:remove-unneeded-where-whitespace, ↵Matthias Krüger-6/+6
r=notriddle Remove unneeded where whitespace It fixes these two bugs: ![Screenshot from 2022-08-31 18-14-40](https://user-images.githubusercontent.com/3050060/187727950-94657419-abfa-454c-9d27-004280fbcb45.png) ![Screenshot from 2022-08-31 18-14-49](https://user-images.githubusercontent.com/3050060/187727956-21d1b39d-62d7-4e7b-8f6f-631ceda67a19.png) It's a relic from a very old time (this commit: https://github.com/rust-lang/rust/commit/bfd01b7f40ae2cbfe9acbc1d10e79ffe16870df8). You can test the result [here](https://rustdoc.crud.net/imperio/remove-unneeded-where-whitespace/lib2/struct.WhereWhitespace.html). cc `````````@jsha````````` r? `````````@notriddle`````````
2022-08-31Remove unneeded extra whitespace before where clauseGuillaume Gomez-6/+6
2022-08-31Rollup merge of #101204 - aDotInTheVoid:async-resugar-in-clean, r=GuillaumeGomezRalf Jung-2/+2
rustdoc: Resugar async fn return type in `clean`, not `html` This way it also happens for json output. Fixes #101199 r? ``@GuillaumeGomez``
2022-08-31Print only blanket implementations on reference primitive typeGuillaume Gomez-67/+133
2022-08-30Clean up render_assoc_items_inner a bitGuillaume Gomez-54/+52
2022-08-30rustdoc: Resugar async fn return type in `clean`, not `html`Nixon Enraght-Moony-2/+2
This way it also happens for json output. Fixes #101199
2022-08-28Auto merge of #100497 - kadiwa4:remove_clone_into_iter, r=cjgillotbors-4/+9
Avoid cloning a collection only to iterate over it `@rustbot` label: +C-cleanup
2022-08-27Rollup merge of #101062 - notriddle:notriddle/text-javascript, r=GuillaumeGomezYuki Okushi-2/+4
rustdoc: remove empty extern_crates and type="text/javascript" on script Like #101023, this removes an attribute with a default value.
2022-08-27Rollup merge of #101018 - notriddle:notriddle/item-right-docblock-short, ↵Yuki Okushi-4/+14
r=GuillaumeGomez rustdoc: omit start/end tags for empty item description blocks Related to #100952 This is definitely not a complete solution, but it does shrink keysyms/index.html on smithay from 620K to 516K.
2022-08-26rustdoc: remove empty extern_crates and type="text/javascript" on scriptMichael Howell-2/+4
Like #101023, this removes an attribute with a default value.
2022-08-26Rollup merge of #101006 - GuillaumeGomez:doc-cfg-reexport, r=notriddleGuillaume Gomez-2/+9
Fix doc cfg on reexports Fixes #83428. The problem was that the newly inlined item cfg propagation was not working since its real parent is different than its current one. For the implementation, I decided to put it directly into `CfgPropagation` instead of inside `inline.rs` because I thought it would be simpler to maintain and to not forget if new kind of items are added if it's all done in one place. r? `@notriddle`
2022-08-25rustdoc: omit start/end tags for empty item description blocksMichael Howell-4/+14
Related to #100952 This is definitely not a complete solution, but it does shrink keysyms/index.html on smithay from 620K to 516K.
2022-08-25Fix missing cfg propagation for reexportsGuillaume Gomez-2/+9
2022-08-24Remove the extra DOM level if there is only one child in rightside elementsGuillaume Gomez-11/+34
2022-08-24Unify rightside renderingGuillaume Gomez-32/+12
2022-08-24Auto merge of #96869 - sunfishcode:main, r=joshtriplettbors-1/+1
Optimize `Wtf8Buf::into_string` for the case where it contains UTF-8. Add a `is_known_utf8` flag to `Wtf8Buf`, which tracks whether the string is known to contain UTF-8. This is efficiently computed in many common situations, such as when a `Wtf8Buf` is constructed from a `String` or `&str`, or with `Wtf8Buf::from_wide` which is already doing UTF-16 decoding and already checking for surrogates. This makes `OsString::into_string` O(1) rather than O(N) on Windows in common cases. And, it eliminates the need to scan through the string for surrogates in `Args::next` and `Vars::next`, because the strings are already being translated with `Wtf8Buf::from_wide`. Many things on Windows construct `OsString`s with `Wtf8Buf::from_wide`, such as `DirEntry::file_name` and `fs::read_link`, so with this patch, users of those functions can subsequently call `.into_string()` without paying for an extra scan through the string for surrogates. r? `@ghost`
2022-08-21Auto merge of #100645 - notriddle:notriddle/rustdoc-diet-plan, r=GuillaumeGomezbors-2/+2
rustdoc: strategic boxing to reduce the size of ItemKind and Type The `Type` change redesigns `QPath` to box the entire data structure instead of boxing `self_type` and the `trait_`. This reduces the size of several `ItemKind` variants, leaving `Impl` as the biggest variant. The `ItemKind` change boxes that variant's payload.
2022-08-20Rollup merge of #100718 - GuillaumeGomez:fix-item-info, r=jshaMatthias Krüger-4/+8
[rustdoc] Fix item info display Fixes #100369. The solution I came up with was simply to wrap the "text part" of the `item-info` into another span so that `flex` wouldn't mess with it. Live demo is [here](https://rustdoc.crud.net/imperio/fix-item-info/foo/struct.ItemInfo.html). r? ``@jsha``
2022-08-18rustdoc: count deref and non-deref as same set of used methodsMichael Howell-6/+11
2022-08-18Fix item-info displayGuillaume Gomez-4/+8
2022-08-16rustdoc: factor Type::QPath out into its own boxMichael Howell-2/+2
This reduces the size of Type.
2022-08-13make clean::Item::span return option instead of dummy spanMichael Goulet-5/+2
2022-08-13avoid cloning and then iteratingKaDiWa-4/+9
2022-08-11Rollup merge of #99337 - jsha:simplify-highlight, r=GuillaumeGomezMatthias Krüger-13/+2
rustdoc: simplify highlight.rs Split render_with_highlighting, which took many optional parameters, into three functions for specific purposes, which each take a smaller number of mostly required parameters. Remove some plumbing to pass through an "edition" parameter, which was used solely to avoid highlighting some 2021 Edition keywords in non-2021 code. I've tested a build of std docs before and after, and this does not change the generated HTML at all. Followup from https://github.com/rust-lang/rust/pull/91264#discussion_r901151101 r? ```@GuillaumeGomez```
2022-08-09rustdoc: simplify highlight.rsJacob Hoffman-Andrews-13/+2
Split render_with_highlighting, which took many optional parameters, into three functions for specific purposes, which each take a smaller number of mostly required parameters. Remove some plumbing to pass through an "edition" parameter, which was used solely to avoid highlighting some 2021 Edition keywords in non-2021 code.
2022-08-09Auto merge of #100150 - notriddle:notriddle/implementors-js, r=GuillaumeGomezbors-17/+62
rustdoc: use a more compact encoding for implementors/trait.*.js The exact amount that this reduces the size of an implementors file depends on whether most of the impls are synthetic or not. For `Send`, it reduces the file from 128K to 112K, while for `Clone` it went from 64K to 44K.
2022-08-07Don't document impossible to call default trait items on implsMichael Goulet-0/+9
2022-08-05rustdoc: use serde, which can escape strings more quicklyMichael Howell-35/+15
This means we don't gain as much as we did from using single-quotes, since serde_json can only produce double-quoted strings, but it's still a win.
2022-08-05rustdoc: reduce the number of intermediate Strings allocatedMichael Howell-12/+21
2022-08-04rustdoc: use a more compact encoding for implementors/trait.*.jsMichael Howell-17/+73
The exact amount that this reduces the size of an implementors file depends on whether most of the impls are synthetic or not. For `Send`, it reduces the file from 128K to 116K, while for `Clone` it went from 64K to 52K.
2022-08-03Rollup merge of #100083 - notriddle:notriddle/source-files-js, r=GuillaumeGomezMatthias Krüger-13/+20
rustdoc: use a more compact encoding for source-files.js This reduces the compiler-doc file from 40K to 36K, a 10% reduction in size.
2022-08-02rustdoc: use a more compact encoding for source-files.jsMichael Howell-13/+20
This reduces the compiler-doc file from 40K to 36K, a 10% reduction in size.
2022-08-02Remove Clean trait implementation for ast::Attribute and cleanup ↵Guillaume Gomez-1/+1
Attributes::from_ast function by splitting it in two
2022-07-30Rollup merge of #99904 - GuillaumeGomez:cleanup-html-whitespace, r=notriddleYuki Okushi-10/+12
Cleanup html whitespace I realized while looking at the raw HTML that we generated some unwanted white space characters. This PR cleans up the one coming directly from rustdoc. I'll check from `pulldown-cmark` for the remaining ones. Some numbers now: the difference is small, it goes from `63009` to `62859`. But multiplied by the number of files, it becomes quite interesting overall. r? `@notriddle`
2022-07-29Box TypedefItem, ImplItem, AssocTypeItem variants of ItemKindest31-2/+2
This reduces ItemKind size from 224 bytes to 160 bytes.
2022-07-29Remove unwanted extra white space characters from HTMLGuillaume Gomez-10/+12
2022-07-27Rollup merge of #99700 - est31:rustdoc_layout_heading, r=GuillaumeGomezYuki Okushi-1/+5
Add a clickable link to the layout section The layout section (activated by `--show-type-layout`) is currently not linkable to (outside of chrome's link to text feature). This PR makes it linkable via `#layout`.
2022-07-25apply review suggestionsMaybe Waffle-1/+1
2022-07-25Add a clickable link to the layout sectionest31-1/+5
2022-07-24add backticksMaybe Waffle-2/+2
2022-07-24Add support for `#[rustc_must_implement_one_of]` to rustdocMaybe Waffle-5/+16
2022-07-22Auto merge of #99598 - GuillaumeGomez:clean-trait-fields-on-demand, r=notriddlebors-5/+5
Make some clean::Trait fields computation on demand r? `@notriddle`
2022-07-22Make some clean::Trait fields computation on demandGuillaume Gomez-5/+5
2022-07-21Remove unused field in ItemKind::KeywordItemGuillaume Gomez-2/+2