about summary refs log tree commit diff
path: root/src/librustdoc
AgeCommit message (Collapse)AuthorLines
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-23rustdoc: remove unused CSS ruleMichael Howell-4/+0
According to [blame], this rule was added to support enum struct variants. However, enum struct variants don't use tables in their design any more, so this rule does nothing. [blame]: https://github.com/rust-lang/rust/blame/87991d5f5d72d6baca490141cb890211ba2f3843/src/librustdoc/html/static/css/rustdoc.css#L748
2022-08-22Auto merge of #100668 - nnethercote:use-AttrVec-more, r=spastorinobors-2/+2
Use `AttrVec` more In some places we use `Vec<Attribute>` and some places we use `ThinVec<Attribute>` (a.k.a. `AttrVec`). This results in various points where we have to convert between `Vec` and `ThinVec`. This commit changes the places that use `Vec<Attribute>` to use `AttrVec`. A lot of this is mechanical and boring, but there are some interesting parts: - It adds a few new methods to `ThinVec`. - It implements `MapInPlace` for `ThinVec`, and introduces a macro to avoid the repetition of this trait for `Vec`, `SmallVec`, and `ThinVec`. Overall, it makes the code a little nicer, and has little effect on performance. But it is a precursor to removing `rustc_data_structures::ThinVec` and replacing it with `thin_vec::ThinVec`, which is implemented more efficiently. r? `@spastorino`
2022-08-22Use `AttrVec` in more places.Nicholas Nethercote-2/+2
In some places we use `Vec<Attribute>` and some places we use `ThinVec<Attribute>` (a.k.a. `AttrVec`). This results in various points where we have to convert between `Vec` and `ThinVec`. This commit changes the places that use `Vec<Attribute>` to use `AttrVec`. A lot of this is mechanical and boring, but there are some interesting parts: - It adds a few new methods to `ThinVec`. - It implements `MapInPlace` for `ThinVec`, and introduces a macro to avoid the repetition of this trait for `Vec`, `SmallVec`, and `ThinVec`. Overall, it makes the code a little nicer, and has little effect on performance. But it is a precursor to removing `rustc_data_structures::thin_vec::ThinVec` and replacing it with `thin_vec::ThinVec`, which is implemented more efficiently.
2022-08-21Auto merge of #100847 - matthiaskrgr:rollup-0ga531s, r=matthiaskrgrbors-102/+151
Rollup of 11 pull requests Successful merges: - #100556 (Clamp Function for f32 and f64) - #100663 (Make slice::reverse const) - #100697 ( Minor syntax and formatting update to doc comment on `find_vtable_types_for_unsizing`) - #100760 (update test for LLVM change) - #100761 (some general mir typeck cleanup) - #100775 (rustdoc: Merge source code pages HTML elements together v2) - #100813 (Add `/build-rust-analyzer/` to .gitignore) - #100821 (Make some docs nicer wrt pointer offsets) - #100822 (Replace most uses of `pointer::offset` with `add` and `sub`) - #100839 (Make doc for stdin field of process consistent) - #100842 (Add diagnostics lints to `rustc_transmute` module (zero diags)) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-08-21Auto merge of #100645 - notriddle:notriddle/rustdoc-diet-plan, r=GuillaumeGomezbors-47/+54
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-21Rollup merge of #100775 - GuillaumeGomez:reduce-span-v2, r=notriddleMatthias Krüger-102/+151
rustdoc: Merge source code pages HTML elements together v2 This is the follow-up of https://github.com/rust-lang/rust/pull/100429. I strongly recommend to review it one commit at a time because otherwise it's a lot at once. For these ones, on each page, I run this JS: `document.getElementsByTagName('*').length`. The goal is to count the number of DOM elements. I took some pages that seemed big, but don't hesitate to check some others. I also added the "starting point" because it's quite nice to see how much the page was reduced thanks to these two PRs. | file name | before #100429 | before this PR | with this PR | diff | |-|-|-|-|-| | std/lib.rs.html (source link on std crate page) | 3455 | 2332 | 1772 | 24% | | alloc/vec/mod.rs.html (source on Vec type page) | 11012 | 5982 | 5833 | 2.5% | | alloc/string.rs.html (source on String type page) | 10800 | 6010 | 5822 | 3.2% | | std/sync/mutex.rs.html (source on Mutex type page) | 2953 | 2041 | 2038 | 0.1% | So unsurprisingly, the more attributes you have, the bigger the difference. You can test it [here](https://rustdoc.crud.net/imperio/reduce-span-v2/src/std/lib.rs.html). cc ``````@jsha`````` r? ``````@notriddle``````
2022-08-21Auto merge of #100624 - GuillaumeGomez:update-minifier-version, r=nnethercotebors-1/+1
Update minifier version to 0.2.2 Following [this PR](https://github.com/GuillaumeGomez/minifier-rs/pull/98), the CSS minification should be much faster now (thanks to `@nnethercote).` r? `@nnethercote`
2022-08-20Rollup merge of #100718 - GuillaumeGomez:fix-item-info, r=jshaMatthias Krüger-4/+9
[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-20Fix hover and focus display for search results on ayu themeGuillaume Gomez-3/+4
2022-08-20Extend decoration test to detect regressionsGuillaume Gomez-3/+8
2022-08-20Clean up highlight `<span>` merge codeGuillaume Gomez-121/+118
2022-08-20Update rustdoc testsGuillaume Gomez-9/+11
2022-08-20Merge "EnterSpan" events to reduce code blocks DOM sizeGuillaume Gomez-23/+68
2022-08-19Fix invalid comparison for Class::Decoration in `is_equal_to`Guillaume Gomez-2/+2
2022-08-19Rollup merge of #100731 - notriddle:notriddle/deref-methods-1, r=jshaDylan DPC-6/+11
rustdoc: count deref and non-deref as same set of used methods Fixes #100679
2022-08-19Rollup merge of #100494 - GuillaumeGomez:cleanup-themes, r=jshaDylan DPC-239/+27
Cleanup rustdoc themes This PR continues our work to simplify the rustdoc themes by relying more on CSS variables. Interestingly enough, this time it allowed me to realize that we were having a lot of different colors for borders even though the difference is unnoticeable. I used this opportunity to unify them. The live demo is [here](https://rustdoc.crud.net/imperio/cleanup-themes/std/index.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/+9
2022-08-18Remove unused CSS ruleGuillaume Gomez-14/+0
2022-08-18Simplify rustdoc themes by relying more on CSS variablesGuillaume Gomez-228/+30
2022-08-18Rollup merge of #100669 - nnethercote:attribute-cleanups, r=spastorinoMatthias Krüger-6/+0
Attribute cleanups r? `@ghost`
2022-08-17Rollup merge of #100379 - davidtwco:triagebot-diag, r=Mark-SimulacrumMatthias Krüger-9/+12
triagebot: add translation-related mention groups - Move some code around so that triagebot can ping relevant parties when translation logic is modified. - Add mention groups to triagebot for translation-related files/folders. - Auto-label pull requests with changes to translation-related files/folders with `A-translation`. r? `@Mark-Simulacrum`
2022-08-17Remove `AttributesExt::other_attrs`.Nicholas Nethercote-6/+0
It's unused.
2022-08-16rustdoc: box ItemKind::TraitMichael Howell-7/+7
This reduces the memory consumption of ItemKind.
2022-08-17Rollup merge of #100630 - Enselic:export_extern_crate_as_self, r=GuillaumeGomezTakayuki Maeda-2/+2
rustdoc JSON: Fix ICE with `pub extern crate self as <self_crate_name>` Closes #100531 r? `@GuillaumeGomez` `@rustbot` labels +A-rustdoc-json +T-rustdoc
2022-08-16rustdoc: factor Type::QPath out into its own boxMichael Howell-40/+47
This reduces the size of Type.
2022-08-16rustdoc JSON: Fix ICE with `pub extern crate self as <self_crate_name>`Martin Nordholts-2/+2
2022-08-16Update minifier version to 0.2.2Guillaume Gomez-1/+1
2022-08-15Rollup merge of #100582 - GuillaumeGomez:rustdoc-json-stripped-enum-variant, ↵Matthias Krüger-6/+4
r=notriddle [rustdoc] Fix handling of stripped enum variant in JSON output format Fixes https://github.com/rust-lang/rust/issues/100529. cc ``@aDotInTheVoid`` ``@Enselic`` r? ``@notriddle``
2022-08-15Rollup merge of #100325 - aDotInTheVoid:rdj-import-impl, r=GuillaumeGomezMatthias Krüger-1/+11
Rustdoc-Json: Don't remove impls for items imported from private modules After #99287, items in private modules may still be in the json output, if a public import accesses them. To reflect this, items that are imported need to be marked as retained in the `Stripper` pass, so their impls arn't removed by `ImplStripper`. [More context on zulip](https://rust-lang.zulipchat.com/#narrow/stream/266220-rustdoc/topic/Populating.20cache.2Eimpls), thanks to @ jyn514 for helping debug this. ``@rustbot`` modify labels: +A-rustdoc-json +T-rustdoc r? ``@GuillaumeGomez`` Fixes #100252 Fixes #100242
2022-08-15rustdoc: Mark imported items as retainedNixon Enraght-Moony-1/+11
Fixes a bug where impl of items that were imported from a private module would be striped Fixes #100252 Fixes #100242
2022-08-15Handle correctly stripped enum variant fieldsGuillaume Gomez-6/+4
2022-08-15errors: move translation logic into moduleDavid Wood-9/+12
Just moving code around so that triagebot can ping relevant parties when translation logic is modified. Signed-off-by: David Wood <david.wood@huawei.com>
2022-08-14Rollup merge of #100523 - GuillaumeGomez:remove-clean-impls, r=Dylan-DPCMatthias Krüger-13/+7
[rustdoc] remove Clean trait Follow-up of https://github.com/rust-lang/rust/pull/99638. This is (finally!) the last part. r? `@Dylan-DPC`
2022-08-14Update rustdoc testsGuillaume Gomez-31/+31
2022-08-14Remove the Clean traitGuillaume Gomez-4/+0
2022-08-14remove Clean trait implementation for hir::VariantGuillaume Gomez-9/+7
2022-08-14Don't generate ident elements as DOM nodesGuillaume Gomez-14/+23
2022-08-14Merge HTML elements in highlighting when they can be merged togetherGuillaume Gomez-8/+155
2022-08-13Rollup merge of #100335 - aDotInTheVoid:rdj-resolved-path, r=GuillaumeGomezMichael Goulet-26/+20
Rustdoc-Json: Add `Path` type for traits. Avoids using `Type` for trait fields, as a trait must always be a path, and not any other kind of type. ``@rustbot`` modify labels: +A-rustdoc-json +T-rustdoc Closes #100106
2022-08-13Rollup merge of #100299 - compiler-errors:issue-100283, r=notriddleMichael Goulet-30/+22
make `clean::Item::span` return `Option` instead of dummy span Fixes #100283
2022-08-13make clean::Item::span return option instead of dummy spanMichael Goulet-30/+22
2022-08-13Rollup merge of #100447 - GuillaumeGomez:rm-clean-impl, r=Dylan-DPCMichael Goulet-25/+33
Remove more Clean trait implementations Follow-up of https://github.com/rust-lang/rust/pull/99638. r? ``@Dylan-DPC``
2022-08-13avoid cloning and then iteratingKaDiWa-11/+17
2022-08-12Adjust cfgsMark Rousskov-1/+0
2022-08-12Rollup merge of #100409 - jsha:highlight-lighter, r=GuillaumeGomezDylan DPC-27/+24
rustdoc: don't generate DOM element for operator In our source page highlighting, we were generating `<span class="op">` tags for all "operators", including e.g. `<` `>` around generic parameters, `*`, `&`. This contributed significantly to DOM size, but we don't actually style `.op` except in the ayu theme. Remove the styles for `.op` in ayu, and stop generating the `<span>`s. This reduces DOM size of an example page[1] from 265,938 HTML elements to 242,165 elements, a 9% reduction. r? ``@GuillaumeGomez`` Demo: (warning - slow!) https://rustdoc.crud.net/jsha/highlight-lighter/src/core/up/up/stdarch/crates/core_arch/src/x86/avx512f.rs.html [1]: https://doc.rust-lang.org/nightly/src/core/up/up/stdarch/crates/core_arch/src/x86/avx512f.rs.html
2022-08-12remove Clean trait implementation for hir::BareFnTyGuillaume Gomez-17/+18
2022-08-12remove Clean trait implementation for hir::PathSegmentGuillaume Gomez-8/+15