about summary refs log tree commit diff
path: root/src/librustdoc
AgeCommit message (Collapse)AuthorLines
2022-08-11rustdoc: don't generate DOM element for operatorJacob Hoffman-Andrews-27/+24
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. [1]: https://doc.rust-lang.org/nightly/src/core/up/up/stdarch/crates/core_arch/src/x86/avx512f.rs.html
2022-08-11Rollup merge of #100392 - nnethercote:simplify-visitors, r=cjgillotMatthias Krüger-7/+2
Simplify visitors By removing some unused arguments. r? `@cjgillot`
2022-08-11Rollup merge of #100374 - ↵Matthias Krüger-42/+98
GuillaumeGomez:improve_rustdoc_search_results_page_crates_selection, r=notriddle Improve crate selection on rustdoc search results page Take over of #98855 (screenshots and explanations are there). You can test it [here](https://rustdoc.crud.net/imperio/improve_rustdoc_search_results_page_crates_selection/std/index.html?search=test). cc ``@steffahn`` ``@jsha`` r? ``@notriddle``
2022-08-11Rollup merge of #99337 - jsha:simplify-highlight, r=GuillaumeGomezMatthias Krüger-79/+75
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-11Rollup merge of #93896 - jsha:dark-colors, r=GuillaumeGomezMatthias Krüger-23/+8
rustdoc: make item-infos dimmer on dark theme Previously the item-info background colors were too bright for a dark theme, making a bright rectangle that draws the attention. Demo: https://rustdoc.crud.net/jsha/dark-colors/std/os/linux/process/struct.PidFd.html https://rustdoc.crud.net/jsha/dark-colors/std/error/trait.Error.html#method.description Before: <img width=300 src="https://user-images.githubusercontent.com/220205/153565049-f35ee83e-181d-491c-b2af-7cce1baa4912.png"> After: <img width=300 src="https://user-images.githubusercontent.com/220205/181166727-b4218e96-daf1-46cd-a2df-5fd870eaa857.png"> r? `@GuillaumeGomez`
2022-08-11Rollup merge of #100391 - nnethercote:improve-size-assertions, r=lqdDylan DPC-9/+10
Improve size assertions r? `@lqd`
2022-08-11Simplify `rustc_hir::intravisit::Visitor::visit_variant_data`.Nicholas Nethercote-7/+2
It has four arguments that are never used. This avoids lots of argument passing in functions that feed into `visit_variant_data`.
2022-08-10rustdoc: make item-infos dimmer on dark theme #93896Jacob Hoffman-Andrews-23/+8
Previously the item-info background colors were too bright for a dark theme, making a bright rectangle that draws the attention.
2022-08-10Add missing ID into the ID mapGuillaume Gomez-1/+2
2022-08-10Two small improvements:Frank Steffahn-3/+2
Fix oversight duplicate property left in CSS (dark theme). Improve wording in comment that mentions `appearance: none`
2022-08-10Improve crate selection on rustdoc search results pageFrank Steffahn-41/+97
Resolves all of issue #93240 Reproduces a similar change as #99086, but with improvements In particular, this PR inlcludes: * redesigning the crate-search selector so the background color matches its surroundings * decrease the font of the dropdown menu to a reaonable size * add a hover effect * make the color of the arrow theme-dependent, using a surrounding div, with :after pseudo-element that can then be transformed using CSS filters to approximate the desired color * fix the text "in" to match the title font * remove the "for xyz" in the "Results for xyz in [All crates]" title when searching for search term "xyz"; you can already see what you're searching for as it's typed in the search bar! * in line with #99086, handle super-long crate names appropriately without a long <select> element escaping the screen area; the improvement is that we also keep the title within a single line now; uses some flex layout shenanigans... * the margins / paddings are adjusted so the selected label of the <select> fits within the rest of that title nicely; also some inconsistency in the way that Firefox renders a <select> with "appearance: none" (roughly 4px more padding left and right of the text than e.g. Chrome) is worked around, and it now produces a result that looks (essentially) identical to Chrome * the color of the help menu and settings menu border in light theme is made to match with the color of the corresponding buttons, like they do (match) in the ayu theme * the casing of "All crates" changes to "all crates" * the new tests from #99086 are temporarily disabled, until they can be adapted later
2022-08-10remove Clean trait implementation for hir::GenericArgsGuillaume Gomez-30/+38
2022-08-10remove Clean trait implementation for ty::AssocItemGuillaume Gomez-172/+175
2022-08-10Rustdoc-Json: Add `Path` type for traits.Nixon Enraght-Moony-26/+20
Closes #100106
2022-08-10Auto merge of #100346 - matthiaskrgr:rollup-6rljn4p, r=matthiaskrgrbors-216/+295
Rollup of 14 pull requests Successful merges: - #98775 (rustdoc: improve scroll locking in the rustdoc mobile sidebars) - #99479 (rustdoc-json: Remove doc FIXME for Import::id and explain) - #100040 (Error on broken pipe but do not backtrace or ICE) - #100072 (linker-plugin-lto.md: Correct the name of example c file) - #100098 (Some "this expression has a field"-related fixes) - #100226 (Do not manually craft a span pointing inside a multibyte character.) - #100240 (Fail gracefully when const pattern is not structural match.) - #100256 (Add some high-level docs to `FnCtxt` and `ItemCtxt`) - #100261 (Set tainted errors bit before emitting coerce suggestions.) - #100275 (also update anyhow in codegen_cranelift) - #100281 (Remove more Clean trait implementations) - #100314 (Mention `unit-test` in MIR opt test README) - #100319 (Remove more Clean trait implementations) - #100323 ([rustdoc] Don't render impl blocks with doc comment if they only contain private items by default) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-08-09rustdoc: simplify highlight.rsJacob Hoffman-Andrews-79/+75
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-10Avoid repeating qualifiers on `static_assert_size` calls.Nicholas Nethercote-9/+10
Some of these don't need a `use` statement because there is already a `#[macro_use] extern crate rustc_data_structures` item in the crate.
2022-08-10Rollup merge of #100323 - GuillaumeGomez:impl-blocks-only-private, r=notriddleMatthias Krüger-17/+54
[rustdoc] Don't render impl blocks with doc comment if they only contain private items by default Fixes #100001. cc `@jhpratt` r? `@notriddle`
2022-08-10Rollup merge of #100319 - GuillaumeGomez:rm-clean-impls-2, r=Dylan-DPCMatthias Krüger-105/+108
Remove more Clean trait implementations Follow-up of https://github.com/rust-lang/rust/pull/99638. r? ``@Dylan-DPC``
2022-08-10Rollup merge of #100281 - GuillaumeGomez:rm-clean-impls-3, r=notriddleMatthias Krüger-69/+62
Remove more Clean trait implementations Follow-up of https://github.com/rust-lang/rust/pull/99638. r? `@notriddle`
2022-08-10Rollup merge of #99479 - Enselic:import-can-be-without-id, r=camelidMatthias Krüger-18/+12
rustdoc-json: Remove doc FIXME for Import::id and explain Also add some test and refactor related code a bit. ``@rustbot`` labels +A-rustdoc-json +T-rustdoc
2022-08-10Rollup merge of #98775 - notriddle:notriddle/mobile-sidebar-scroll-lock, r=jshaMatthias Krüger-7/+59
rustdoc: improve scroll locking in the rustdoc mobile sidebars This PR prevents the main content area from scrolling while the mobile sidebar is open on documentation pages (porting the scroll locking behavior from the source sidebar to the regular sidebar), and also fixes some bad behavior where opening a "mobile" sidebar, and growing the viewport so that the "desktop" mode without scroll locking is activated, could potentially leave the page stuck. This does not affect the behavior on larger screens. Only small ones, where the sidebar covers up the main content. Split out from #98772
2022-08-09Auto merge of #100150 - notriddle:notriddle/implementors-js, r=GuillaumeGomezbors-22/+73
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-09Prevent impl blocks containing only private items to be documented by defaultGuillaume Gomez-17/+54
2022-08-09remove Clean trait implementation for ast::ModuleGuillaume Gomez-69/+62
2022-08-09Rollup merge of #100221 - compiler-errors:impossible-trait-items, ↵Dylan DPC-0/+9
r=lcnr,notriddle,camelid Don't document impossible to call default trait items on impls Closes #100176 This only skips documenting _default_ trait items on impls, not ones that are written inside the impl block. This is a conservative approach, since I think we should document all items written in an impl block (I guess unless hidden or whatever), but the existence of this new query I added makes this easy to extend to other rustdoc cases.
2022-08-09Rollup merge of #99787 - aDotInTheVoid:rdj-dyn, ↵Dylan DPC-61/+59
r=camelid,notriddle,GuillaumeGomez Rustdoc-Json: Document HRTB's on DynTrait Closes https://github.com/rust-lang/rust/issues/99118 Probably best reviewed commit by commit. `@rustbot` modify labels: +A-rustdoc-json cc `@Enselic` r? `@CraftSpider`
2022-08-09Auto merge of #100304 - matthiaskrgr:rollup-gs56vlw, r=matthiaskrgrbors-58/+64
Rollup of 6 pull requests Successful merges: - #100163 (Refactor: remove an unnecessary string search) - #100212 (Remove more Clean trait implementations) - #100238 (Further improve error message for E0081) - #100268 (Add regression test for #79148) - #100294 (Update Duration::as_secs doc to point to as_secs_f64/32 for including fractional part) - #100303 (:arrow_up: rust-analyzer) Failed merges: - #100281 (Remove more Clean trait implementations) r? `@ghost` `@rustbot` modify labels: rollup
2022-08-09Rollup merge of #100212 - GuillaumeGomez:rm-clean-impls, r=Dylan-DPCMatthias Krüger-58/+64
Remove more Clean trait implementations Follow-up of https://github.com/rust-lang/rust/pull/99638. r? `@notriddle`
2022-08-09Auto merge of #100205 - cjgillot:noice-doc, r=camelidbors-10/+18
Avoid ICE in rustdoc when using `Fn` bounds Fixes https://github.com/rust-lang/rust/issues/100143
2022-08-08Synthetize a trait ref when none is available.Camille GILLOT-6/+12
2022-08-08remove Clean trait implementation for hir::GenericsGuillaume Gomez-68/+67
2022-08-08remove Clean trait implementation for hir::ImplItemGuillaume Gomez-39/+43
2022-08-07Don't document impossible to call default trait items on implsMichael Goulet-0/+9
2022-08-07remove Clean trait implementation for ty::PredicateGuillaume Gomez-22/+23
2022-08-07remove Clean trait implementation for hir::WherePredicateGuillaume Gomez-36/+41
2022-08-06rustdoc: do not mark the contents of a skipped module as inlinedMichael Howell-21/+43
2022-08-06Avoid ICE in rustdoc.Camille GILLOT-5/+7
2022-08-06Rollup merge of #100193 - GuillaumeGomez:rm-clean-impls, r=notriddleMatthias Krüger-48/+42
Remove more Clean trait implementations Follow-up of https://github.com/rust-lang/rust/pull/99638. r? `@notriddle`
2022-08-06remove Clean trait implementation for hir::PolyTraitRefGuillaume Gomez-7/+1
2022-08-06remove Clean trait implementation for hir::GenericBoundGuillaume Gomez-41/+41
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-05Rollup merge of #100166 - GuillaumeGomez:rm-clean-impls, r=Dylan-DPCDylan DPC-64/+65
Remove more Clean trait implementations Follow-up of https://github.com/rust-lang/rust/pull/99638. r? `@notriddle`
2022-08-05rustdoc: reduce the number of intermediate Strings allocatedMichael Howell-13/+22
2022-08-05remove Clean trait implementation for hir::TraitItemGuillaume Gomez-51/+51
2022-08-05remove Clean trait implementation for hir::PolyTraitRefGuillaume Gomez-13/+14
2022-08-04rustdoc: use `collect()` instead of repeatedly pushing to boundsMichael Howell-12/+12
2022-08-04rustdoc: use `collect()` instead of repeatedly pushing to bindingsMichael Howell-5/+5
2022-08-04rustdoc: use a more compact encoding for implementors/trait.*.jsMichael Howell-21/+83
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-04remove Clean trait implementation for hir::TraitRefGuillaume Gomez-8/+6